subject

The cash register program will have items. For each item, the name and cost are saved. For a transaction, it will accept any number of items (not known in advance) and any number of payments of different payment types (not known in advance). For each transaction, it calculates the total including a 7% sales tax and keeps prompting for a payment until the total has been paid. It also determines if any change is required. Thus, a transaction is responsible for calculating the amount of money that needs to be paid, accepting money, and generating a receipt. A receipt holds information about a transaction so that it can display how much each item cost, how the transaction was paid for, etc. (see example outputbelow).Payment type includes CASH, DEBIT_CARD, CREDIT_CARDandCHECK. Each payment consists of an amount and payment type Hints
1. All fields should be private.
2. The PaymentType class should be an enum class with values: CASH, DEBIT_CARD, CREDIT_CARD, CHECK
3. Payment type information should not print the enum directly
4. Use final to store the transaction for each receipt.
5. Output:
A. The values for subtotal, tax, total, and payment information are all aligned. You can achieve this by using the tab character '\t' in your Strings. The item lines do not need to be aligned.
B. Do not worry about only using 2 decimal places. Let Java decide how many decimal places to use.
6. Create a main class to house the main method. In the main method, create some items, a transaction, and display the receipt.
A. Example outputs
Example: Pay everything with one payment
Transaction listing the items and asking for payment:
Item 1: apple: 0.5
Item 2: pear: 0.75
Item 3: pineapple: 0.75
Total: 2.14
Please enter payment type.
1. Cash
2. Debit card
3. Credit card
4. Check
2
Enter the amount to pay with this type.
2.14
Total after payment: 0.0
Receipt printed:
apple: 0.5
pear: 0.75
pineapple: 0.75

Subtotal:
Tax:
Total:
Debit:
Change: 2.0 0.14 2.14 2.14 0.0
Example: Paying with multiple payments and payment type
Item 1: refrigerator: 800.71
Total: 856.7597000000001
Please enter payment type.
1. Cash
2. Debit card
3. Credit card
4. Check
1
Enter the amount to pay with this type.
400
Total after payment: 456.75970000000007
Please enter payment type.
1. Cash
2. Debit card
3. Credit card
4. Check
2
Enter the amount to pay with this type.
475
Total after payment: -18.240299999999934
refrigerator: 800.71
3
Subtotal: 800.71
Tax: 56.04970000000001
Total: 856.7597000000001
Cash: 400.0
Debit: 475.0
Change: 18.240299999999934
Example: Using the same payment type multiple times
Item 1: apple: 0.5
Item 2: pear: 0.75
Item 3: pineapple: 0.75
Total: 2.14
Please enter payment type.
1. Cash
2. Debit card
3. Credit card
4. Check
1
Enter the amount to pay with this type.
1.25
Total after payment: 0.8900000000000001
Please enter payment type.
1. Cash
2. Debit card
3. Credit card
4. Check
1
Enter the amount to pay with this type.
10.50
Total after payment: -9.61
apple: 0.5
pear: 0.75
pineapple: 0.75
Subtotal: 2.0
Tax : 0.14
Total: 2.14
Cash: 1.25
Cash: 110.5
Change: 9.61

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 20:50, solo4360
What does operator overloading allow you to do?
Answers: 2
image
Computers and Technology, 22.06.2019 09:40, Tyrant4life
It is vital to research each of the services you plan to disable before implementing any change, especially on critical machines such as the: a. servers in the test environment. b. domain controller and other infrastructure servers. c. desktops that have previously been attacked. d. desktops used by upper-level management.
Answers: 2
image
Computers and Technology, 22.06.2019 12:30, gerardoblk5931
An atom's diameter is about 0.1 nanometer (1×10-9m), and a human hair is about 1×10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
image
Computers and Technology, 23.06.2019 21:30, jayybrain6337
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
You know the right answer?
The cash register program will have items. For each item, the name and cost are saved. For a transac...

Questions in other subjects: