Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write this program in JAVA: 1. At the start of the program, display the company name. 2. Ask the user to type in their name,
Write this program in JAVA:
1. At the start of the program, display the company name. 2. Ask the user to type in their name, phone number and postal code. 3. Display a menu containing these 5 choices: 1. Add to cart 2. Remove from cart 3. View cart 4. Check out 5. Cancel How can I help you today? 1. Add to cart 2. Remove from cart 3. View cart 1. Checkout 5. Cancel Choose a menu option (1-5): 1 When the user chooses "Add to cart", you will present the user with a menu that lists the 5 items you have for sale. Instead of asking one by one how much of each item they would like to purchase, they will choose an item to purchase. After they pick an item from the menu, ask them how many of that item they would to purchase, and add it to a variable that keeps track of the total number of that item they have in their shopping cart. What would you like to add to your shopping cart? 1. Apples ($0.751 2. Bananaa (80.50) 3. Carrota (30.25) 4. Dragonfruit (87.50) 5. Eggplant ($1.751 Choose a fruit/vegetable (1-5): 1 How many would you like to add: 10 . After the user adds an item, they should automatically see the menu again. DO NOT ask them if they want to return to the menu, this should be automatic. When the user chooses "Remove from cart", this will be similar to the previous option, except this will allow the user to remove items that are already in their cart. What would you like to remove to your shopping cart? 1. Apples ($0.75) 2. Bananas ($0.50) 3. Carrots ($0.25) 4. Dragonfruit ($7.50) 5. Eggplant ($1.75) Choose a fruit/vegetable (1-5): 1 many would you like to remove: . After the user removes an item, they should automatically see the menu again. DO NOT ask them if they want to return to the menu, this should be automatic. When the user chooses "View cart", display the items the user has in their cart. The following items are in your cart: ITEMS QUANTITY PRICE Apple Bananas Carrots Dragonfruit Eggplants 7 0 0 $5.25 $0.00 $0.00 $0.00 $0.00 After the user views the cart, they should automatically see the menu again. DO NOT ask them if they want to return to the menu, this should be automatic. When the user chooses "Check out", thank the user by name for shopping with your company. Then print the same receipt as your Unit 2 project. Remember to use a Decimal Formatter for money output AND display the receipt in a proper table. Thank you for shopping with us, Jack ITEMS QUANTITY PRICE 7 0 0 0 Apples Bananas Carrots Dragonfruit Eggplants EEEEEEEE $5.25 $0.00 $0.00 $0.00 $0.00 0 $5.25 SUBTOTAL TAX TOTAL $0.68 $5.93 Thanks for shopping at Walmart! The program should now end. There is no point returning to the menu as they have already checked out. When the user chooses "Cancel", end the program without a purchase being made or a receipt being shownStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started