Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a code in java language please if u can provide the code as written too so i can copy and paste it *Write a

write a code in java language please if u can provide the code as written too so i can copy and paste it 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
*Write a java program with the following instructions Create a java class item then do the following: Data Members Flavor Quantity Price Data Type of Member String 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 Site 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.5D 1.5D PD 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 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 com olives, or/and onions. Create a java class Ice-cream which inherited from Item class after that do the following: Data Members humorScoop Data Type of Member 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 Nanilla Price 1.5 JD 2D 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 Members d orderitems billAmount Data Type of Member int ArrayListcitem> double 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 calculate Bill Amount () method it will calculate the total amount price of the user order. 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 informations 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 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 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: 1 1 1 Flavor Quantity Toppings price Margherita 2 olives, onions SJD I 1 Flavor 1 Quantity # of scoops price 1 3 3.500 Pistachio 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 to exit the program Please enter your choice 1 Please enter i 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: price | Flavor Quantity Toppings 188Q Chicken 1 corns 2D 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 to exit the program Please enter your choice 6 of 9 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: Flavor Quantity of scoops Strawberry 1 2 price 2.5D Press 1 to insert a new order. Press 2 to list all orders in the system. Press 3 to cancel a specific order Press to exit the program Please enter your choice: 2 7 of 9 The orders in the system are: 1 w1 Flavor Quantity price 1 Toppings olives, onions Margherita 2 5JD Flavor Quantity # of scoops price 1 Pistachio 1 3 3.5JD 1 Total Bill 8.5JD 1 IDN2 1 price | Flavor Quantity Toppings BBQ Chicken 1 corns 2JD 1 1 Total Bill 2 1 1 IDN3 1 price Flavor Quantity of scoops Strawberry 1 2 2.5JD 1 1 Total Bill 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 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: IDA2 1 Flavor Quantity Toppings price 1 BBQ Chicken 1 corns 2JD 1 Total Bill 2JD 1 ID#3 . Flavor Quantity #of scoops price 1 Strawberry 1 2 2.5D Total Bill 2.5D 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