ass “Pizza”, and three sub-classes “Cheese Pizza”, “Pepperoni Pizza” and “VeggiePizza”. The class Pizza will have an attributes pizzaSize of type String and another attribute sizePrice of type double. The attribute sizePrice will give the price of the pizza sizes. The sizes can be small, medium and large and their respective price is Rs 600, Rs 800 and Rs 1000. Implement a method getSizePrice(String size) which returns the price of the size mentioned in parameter. Define a method calculatePrice(String size) which returns a double value. The three subclasses will have their attribute toppingPrice of type double. Create a test application where user should be able to: First select the appropriate Pizza type Then select the pizza size The system should then calculate total of price (This total should be total of the pizza size and topping) Display the complete order along with total price at the end Create all getter setters, use polymorphism
Create a class “Pizza”, and three sub-classes “Cheese Pizza”, “Pepperoni Pizza” and “VeggiePizza”. The class Pizza will have an attributes pizzaSize of type String and another attribute sizePrice of type double. The attribute sizePrice will give the price of the pizza sizes. The sizes can be small, medium and large and their respective price is Rs 600, Rs 800 and Rs 1000. Implement a method getSizePrice(String size) which returns the price of the size mentioned in parameter. Define a method calculatePrice(String size) which returns a double value.
The three subclasses will have their attribute toppingPrice of type double.
Create a test application where user should be able to:
First select the appropriate Pizza type
Then select the pizza size
The system should then calculate total of price (This total should be total of the pizza size and topping)
Display the complete order along with total price at the end
Create all getter setters, use polymorphism and method overriding. Use your own attributes and supporting methods wherever required.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps