Question
Create a Java project called (clsCashRegister.java) The context of this project is a cash register at a shop. The cash register should display a list
Create a Java project called (clsCashRegister.java)
The context of this project is a cash register at a shop. The cash register should display a list of items for sale with the price for each item. The cash register should calculate the total cost of the users purchase, receive a payment from the user, add tax to the cost, deduct the cost from the payment, and return the exchange back to the user.
Display a welcome message: Welcome to Cash Mart
Display a message to the users with the options below. Create a method called ViewOptions() to display the options below. This method doesnt accept any parameters and does not return anything. This method should be called right after you display the message in Step 1, and after all options below accomplish their deliverable:
a. Type view to view items and prices.
b. Type purchase to make a purchase.
c. Type delete to remove items from the cart. [optional#2].
d. Type cart to view currents item in the cart [optional#3].
e. Type pay to make a payment
f. Type exit to terminate the program
if the user types anything else, then display an error message invalid option.
If the user types view, call a method called View Items(), which accepts no parameters and returns nothing. The method should display the following:
*****************We have the following items******************
- Bananas--------------------------------- $1.50 / pound
- Apples ---------------------------------- $2.50/ pound
- Pizza ------------------------------------- $9.99 / large pizza
- Pop--------------------------------------- $1.99 / bottle
- Coffee ----------------------------------- $ 1.59 / cup
b. If the user types purchase, display each item with its price and ask the user to input the number of each item. Once all items are purchased, call the method in Step 4. Your message should look like the message below. Repeat this for all items in the list with your own quantities:
Enter number of pounds of Bananas @ $1.5/ pound: 5 You entered 5 pounds of Bananas, hit y to confirm, n to re-enter bananas. Enter the number of pounds of Apples @ $2.5 / pound: 100 You entered 100 pounds of apples, hit y to confirm, n to re-enter . [repeat for all items]
Once all items are displayed, and items are chosen purchase, call a method called CalculatePurchase(dblBanana, dblApple, intPizza, intPop, intCoffee) which accepts 6 parameters as doubles and integers [refer to the names in the method] , each representing the number of items purchased, and then returns the total cost of the purchase in USD. This method should be called after a purchase is made; it should also add a tax sale of 8.1% on all purchases made. Once this method is called, display a summary of purchases including the number of items, items names, price per item, total of each item, the number of total categories purchased, the sales tax, and the total amount due to pay. The item category is the number of non-zero items purchases. In this case, its apples, pizza, and pop which is 3.
The following items are purchased:
No. Items | Item name and cost | Total($) --------------------------------------------------------------------------------------
0 |Bananas |0.00
3 |Apples |7.50
1 |Pizza |9.99
4 |Pop |7.96
0 |Coffee |0.00
No. categories 3 $25.45
Sales Tax (8.1%) $2.06
Total $ 27.51
Please, type pay to make a payment.
Once pay is typed, call a method called Pay(dblCost, dblPayment) which accepts two double values, the cost of the purchase returned from the CalculatePurchase() method, and the payment provided from the user. This method should return the exchange for the user in USD. If the payment is less than the cost, ask the user to insert the payment again. You can accept the payment when you call the Pay method. When this method is called, pass the cost and the mount 0 as payment, then calculate the change. Then display a message with the transaction, something like this:
>>pay
Your total purchase is $27.1, please enter payment in USD:
>> 5
You still owe $22.1, please enter payment again in USD:
>> 30
Your change is $7.9.
Create a method called ExchangeReturn(dblExchange) to calculate the number of bill and coins to be returned. SAMPLE USER EXPERIENCE The following is an example of what the user should experience. Try to make you program to look like the below user experience. Highlighted text indicates an input from the user and italic text indicates the output of your program. Reasonable modifications are acceptable. ========================================
Welcome to Cash Mart, please choose one of the options below: Type view to view items and prices. Type purchase to make a purchase. Type delete to remove items from the cart. (optional). Type cart to view currents item in the cart (optional). Type pay to make a payment >> hello Invalid input, please choose a valid input Welcome to Cash Mart, please choose one of the options below: Type view to view items and prices. Type purchase to make a purchase. Type delete to remove items from the cart. (optional). Type cart to view currents item in the cart (optional). Type pay to make a payment
>> DELETE
Nothing to delete. Cart is empty.
>> Cart is empty
>>View
*****************We have the following items******************
Bananas ----------------------- $1.50 / pound
Apples ----------------------- $2.50 / pound
Pizza ----------------------- $9.99 / large pizza
Pop ----------------------- $1.99 / bottle
Coffee ----------------------- $1.59 / cup
Enter the number of items youd like to purchase:
No. of Bananas at 1.50/pound
>>0 No. of apples at 2.50/pound
>>3 No. of large pizza
>>1 No. of pop bottles
>>2 No. of cups of coffee
>>0
The following items are purchased No. Items | Item name |
Total ($) ----------------------------------------------
0 |Bananas | 0.00
3 |Apples | 7.50
1 |Pizza | 9.99
2 |Pop | 3.98
0 |Coffee | 0.00
No. Items 6 $21.47
Sales Tax (8.1%) $1.73
Total $23.20
Welcome to Cash Mart, please choose one of the options below:
Type view to view items and prices.
Type purchase to make a purchase.
Type delete to remove items from the cart. (optional).
Type cart to view currents item in the cart (optional).
Type pay to make a payment
>>PAY
Your total purchase is $23.20, please enter payment in USD:
>> 5
You still owe $18.20, please enter payment again in USD:
>> 30 Your change is $11.80.
>>exit
Thank you, come again.
Step 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