Hi guys I'm trying to do this java exercise and I'm getting nowhere with this So I was wondering if anyone can help me out with this.
1. Create a PizzaOrder.java class with the following attributes and methods:
PizzaOrder
-size: String
-toBeDelivered: boolean
-count: int
+PizzaOrder()
+PizzaOrder(size: String, toBeDelivered: boolean)
+getSize(): String
+isToBeDelivered(): boolean
+getCount: int
+setSize(size: String): void
+setToBeDelivered(toBeDelivered: boolean): void
+calculatePrice(): double
+toString(): String
For size:
“small” – small
“medium” – medium
“large” – large
“extra” – extra large
The price should be calculated as the following:
Base price:
Small pizza: 6.99
Medium pizza: 8.99
Large pizza: 10.99
Extra large pizza: 12.99
If user wants the pizza to be delivered, add additional $3.00 as the tip.
2. Under the same project, create a PizzaWithToppings Class, which is a subclass of PizzaOrder class.
PizzaOrder
Δ
PizzaWithToppings
-sausage: boolean
-pepperoni: boolean
-peppers: boolean
+PizzaWithToppings()
+PizzaWithToppings(sausage: boolean, pepperoni: boolean, peppers: boolean, size: String, toBeDelivered: boolean)
+isSausage(): boolean
+isPepperoni (): boolean
+isPeppers (): boolean
+setSausage(sausage: boolean): void
+setPepperoni (pepperoni: boolean): void
+setPeppers (pepprers: boolean): void
+calculatePrice(): double
+toString(): String