Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this program in Java!! thank you! DESCRIPTION Create a class named clsCashRegister(). Your main method and all other methods should be inside this

Please write this program in Java!!

thank you!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

DESCRIPTION Create a class named clsCashRegister(). Your main method and all other methods should be inside this class. 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 user's 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. You project should include the methods below and deliver the described task for each. 1. Display a welcome message and your personal information. Create a method called DisplayInfo () to display the welcome message and your personal information. This method doesn't take any parameters and doesn't return anything. When this method is called, display the following: (5 points) ==================================================================== "Welcome to Cash Mart You Last name, First name Your Email address CS110-001, Spring 2020 Project No.1 - Cash Register ====================================================================== 2. Display a message to the users with the options below. Create a method called ViewOptions() to display the options below. This method doesn't 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: (10 points) 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. 3. Read a user option from the list in Step 2, if the user types anything else, then display an error message invalid option. [15 points) a. If the user types "view", call a method called ViewItems () which accepts no parameters and returns nothing. The method should display the following: (10 points) *****************************IAL have the followin **We have the following items****************** i. Bananas----- ii. Apples iii. Pizza ---- iv. Pop--- V. Coffee -------- -- $1.50 / pound $2.50/ pound $9.99 / large pizza $1.99 / bottle --- $ 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, hity 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] 4. 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($) Tomato Bananas | Apples Pizza | Pop Coffee No. categories 3 Sales Tax (8.1%) Total 10.00 17.50 19.99 17.96 10.00 $25.45 $2.06 $ 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: [20 points) >>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

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

Recommended Textbook for

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

Which listening behavior do I want to improve the most?

Answered: 1 week ago