I'm writing a program that can output the price of pizza, I had already written the beginning, but I don't know how to continue it...please give me a small hint so I can know how to write it.
There are 3 properties, which are price, size(small, medium and large), and several toppings which have 2 types so 2 prices for the toppings. I am asked to use class, method, fields, methods, enumerations, and constructors.
void addTopping(string topping) {
cout << "Enter the topping you want to add: pepperoni, sausage, meatball, greenpeppers, onion, black olives, and mushrooms.";
}
int getPrice(char size, int topping) {
}
};
int main() {
cout << "Enter the size of pizza (s is small, m is medium, l is large)" << "\n";
cin >> size;
Given that you're using a Pizza class, create a Pizza object and set its size using the information the user entered.
int getPrice(char size, int topping)
This looks wrong. The Pizza knows its own size. The pizza knows its own toppings. You should not need to provide a size or topping when asking the pizza for the price.