Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: Students will implement a simple user interface using scanner and handle user input commands with conditionals, iterations, and file reading. Description: Your goal is

Objective: Students will implement a simple user interface using scanner and handle user input commands with conditionals, iterations, and file reading. Description: Your goal is to create a simple interactive user interface emulating a simple checkout experience, much like you might experience while buying products online on Amazon. A user will be able to: 1. add items to their cart 2. view their cart 3. clear their cart 4. checkout with their cart 5. exit the program

1. Products (and their prices) that can be added to a users cart will be stored in a file called productdatabase.txt. We will provide an example version of this file you can use. a. Each line is guaranteed to have a product name and its price separated by a space. b. NOTE: Your program should work with any file of any number of lines. 2. A menu will be displayed on loop to the user (meaning after a user completes a selection, the menu will be displayed again). Menu options should be: a. Add item: i. A list of available items will be displayed to the user [including their prices]. List of 5 items on a file. ii. A user will be asked for the name of the product they want to add to their cart. iii. If the product database contains the requested item, add 1 item to the cart and increase the cart total by the price of the item. Print the new number of items in the cart and the new total price of their cart. iv. If the item is not found in the product database, print an error message to the user and go back to the menu. v. NOTE: Your program does not have to keep track of which items the user adds to their cart, only the number of items added and the running total price of the cart. b. View cart i. The current number of items as well as the total price of the cart will be displayed to the user. c. Clear cart i. Set the number of items in the cart to 0 and set the price of the cart to $0.00. ii. Print the new cart details to the user. d. Check out i. The current number of items as well as the total price of the cart will be displayed to the user. ii. The user will have the option of paying in full, in 6 month payments, or in 12 month payments 1. If the user decides to pay in full, the entire total will be due at checkout. 2. If the user decides to pay in 6 month installments, 1% interest will be added to the total. 1/6th of that total will be due at checkout. 3. If the user decided to pay in 12 month installments, 2% interest will be added to the total. 1/12th of that total will be due at checkout. . For simplicity, the user will be asked to pay with a gift card. The user will enter the total amount they have on their gift card. 1. If the gift card amount is not enough to cover todays total, display an error message to the user. The cart will remain unchanged. 2. Otherwise, print the remaining gift card balance to the user and empty the cart. e. Exit i. A goodbye message will be displayed to the user and the program will quit.

IN JAVA PLEASE!! THANK YOU.

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

How to safely discipline or terminate an employee?

Answered: 1 week ago

Question

7. Senior management supports the career system.

Answered: 1 week ago