Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this beginner level java coding assignment. Please write in a very simplistic/easy to understand coding style, and please add proper comments/documentation on

Need help with this beginner level java coding assignment. Please write in a very simplistic/easy to understand coding style, and please add proper comments/documentation on the methods/variables/fields/objects/class names so I can understand better. Thank you!

image text in transcribed

image text in transcribed

image text in transcribed

Requirements 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 output below). Payment type includes CASH, DEBIT_CARD, CREDIT_CARD and CHECK. Each payment consists of an amount and payment type. You must also record a video explaining your code and your UML diagram. For the code and UML explanations: Use the appropriate terminology e.g. class, field Do not just read of each line of your code. Provide and explanation of what is happening As you step thru your code, use example input to illustrate how your program solves the problem for all scenarios in the 'Example output'. Hints 1. All fields should be private. 2. Create multiple classes for each "thing". 3. The PaymentType class should be an enum class with values: CASH, DEBIT_CARD, CREDIT CARD, CHECK 4. Payment type information should not print the enum directly 5. Use final to store the transaction for each receipt. 6. 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. 7. Create a main class to house the main method. In the main method, create some items, a transaction and display the receipt. Example outputs Example: Pay everything with one 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 apple: 0.5 pear: 0.75 pineapple: 0.75 Subtotal: 2.0 Tax: Total: Debit: Change: 0.0 0.14 2.14 2.14 Example: Paying with multiple payments and payment types. 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 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: Total: Cash: Cash: Change: 9.61 0.14 2.14 1.25 10.5

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions