Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java for beginners please *Write a java program with the following instructions: Create a java class Item then do the following: Data Type of

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

in java for beginners please

*Write a java program with the following instructions: Create a java class Item then do the following: Data Type of Member String Pata Members Flavor Quantity Price int double 1. Setters and getters data Fields. 2. Create two constructors: one with no arguments, the other with arguments (arguments to assign values of all data fields except the price in the class). 3. Override toString () method: you have to return all data field values. 4. Define calculatePrice () method as abstract. Create a java class Pizza which inherited from Item class after that do the following: Data Members Toppings Size Data Type of Member String String 1. Setters and getters data Fields. 2. Create two constructors: one with no arguments, the other with arguments (arguments to assign values of all data fields in the class). 3. Override toString() method: you have to return all data field values. 4. Override calculate Price () method it will calculate the price of item pizza according to the following: Type of pizza Four Season BBQ Chicken Margherita Price 2.5 JD 1.5 JD 2 JD The price can be computed according to the type of pizza and half a dinar for each topping's user- chosen times the quantity. Note: flavor data member may take just three values four-season, BBQ chicken, or Margherita, and size of pizza may take just small, medium, or large, finally topping may take a combination of corn, olives, or/and onions. Create a java class Ice-cream which inherited from Item class after that do the following: Data Members numOfScoop pata Type of Member nt 1- Setters and getters data Fields. 2- Create two constructors: one with no arguments, the other with arguments (arguments to assign values of all data fields in the class). 3- Override toString() method: you have to return all data field values. 4- Override calculate Price () method it will calculate the price of item ice-cream according to the following: Type of ice-cream Strawberry Pistachio Vanilla Price 11.5 JD BJD 75 JD The price can be computed according to the type of ice-cream and half a dinar for each scoop's times the quantity. Note: flavor data member may take just three values Strawberry, Pistachio, or Vanilla. Create a java class Order then do the following: Data Type of Member Data Members lid orderltems int ArrayList pouble billAmount Required setters and getters data Fields. Create two constructors: one with no arguments, the other with arguments (arguments to assign values of all data fields in the class). Override toString () method: you have to return all data field values. 4. Create calculateBillAmount () method it will calculate the total amount price of the user order. Note: Id should be statically incremented with the new order option. Create a java main class Test then do the following: 1- Crate an ArrayList of type Order AllOrders. 2- Print the following menu to give the user optionality: Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program. *when the user chooses the first choice, then give the user optionality to enter 1 for pizza and 2 for ice-cream order then the information's for the new order (flavor, size, toppings, and quantity) for pizza and (flavor, quantity, and the number of scoops) then prompt from the user to enter 1 to Add- item (the new pizza/ice-cream will be added to his/her items) or close order options (the new pizza/ice-cream will be added to his/her items and this order will be added to AllOrders ArrayList the system will be ready for a new order from a new user). *when the user chooses the second one, you should retrieve all the orders in the AllOrders Arraylist. *when the user chooses the third choice, you should cancel the order from AllOrders ArrayList. Sample Run: Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program Please enter your choice: 1 Please enter 1 for pizza and 2 for ice-cream: 1 Please enter the pizza flavor: Margherita Please enter the quantity: 2 Please enter the toppings corn, olives, and/or onions: Olives onions Please enter 1 for Add Item and 2 for Close Order: 1 Please enter 1 for pizza and 2 for ice-cream: 2 Please enter the ice-cream flavor: Pistachio Please enter the quantity: 1 Please enter the number of scoops you want: 3 Please enter 1 for Add Item and 2 for Close Order: 2 Your order is: |Flavor Quantity Toppings price Margherita 2 olives, onions 5JD 1 1 Flavor Quantity # of scoops price . Pistachio 1 3 3.5JD . 1 Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program Please enter your choice: 1 Please enter 1 for pizza and 2 for ice-cream: 1 Please enter the pizza flavor: BBQ Chicken Please enter the quantity: 1 Please enter the toppings corn, olives, and/or onions: corns Please enter 1 for Add Item and 2 for Close Order: 2 Your order is: 1 |Flavor Quantity Toppings price |BBQ Chicken 1 corns 2JD Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program Please enter your choice: 1 Please enter 1 for pizza and 2 for ice-cream: 2 Please enter the ice-cream flavor: Strawberry Please enter the quantity: 1 Please enter the number of scoops you want: 2 Please enter 1 for Add Item and 2 for Close Order: 2 Your order is: 1 | Flavor Quantity # of scoops price Strawberry 1 2 2.5JD Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program Please enter your choice: 2 The orders in the system are: 1 ID #1 | |Flavor Quantity Toppings price | Margherita 2 olives, onions 5JD 1 | Flavor Quantity # of scoops price | Pistachio 1 3 3.5JD I Total Bill 8.5JD 1 1 ID#2 . | Flavor Quantity Toppings price I | BBQ Chicken 1 corns 2JD I I Total Bill 2JD 1 1 ID#3 I |Flavor Quantity # of scoops price I Strawberry 1 2 2.5JD I 1 Total Bill 2.5JD 1 Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order. Press O to exit the program Please enter your choice: 3 please enter the order id you want to cancel: 1 The orders in the system are: ID#2 1 Flavor Quantity Toppings price | BBQ Chicken 1 corns 2JD 1 Total Bill 2JD 1 | ID#3 1 Flavor Quantity # of scoops price 1 Strawberry 1 2 2.5JD 1 Total Bill 2.5JD 1 Good Luck

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+Is the fear appropriate for the audience?

Answered: 1 week ago