Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class called Cashier that directs a cashier how to cash goods and give c

ID: 3623828 • Letter: W

Question

Write a class called Cashier that directs a cashier how to cash goods and give change to customers. The typical cashier operations are as follows:
(a) Clear the cash register machine.
(b) Enter the name and the price of each item in the cash registering machine.
(c) The customer tenders an amount of money to pay for the goods (We assume the amount covers the total).

(d) The cash machine computes:
i. The number of items purchased
ii. The total amount of purchase
iii. The average price of each item
iv. The number of coin denominations that the customer should receive. That is, the number of silver dollars, quarters, dimes, nickels, and cents the customer should receive in turn. In addition.

Here is a what I have

class TestCashier
{
public static void main(String[] arg)
{
Cashier c = new Cashier();

String name = GetData.getWord(“Enter name of item”);
double price = GetData.getDouble(“Enter price of item”);
c.add(name, price);

name = GetData.getWord(“Enter name of item”);
price = GetData.getDouble(“Enter price of item”);
c.add(name, price);

// Add a two more entries of your own

// Now average the price of the items
c.average();

// Make payment
double amount = GetData.getDouble(“Enter amount of money for payment”);

c.tendered(amount); // For example twenty dollars were tendered
c.makeChange();

generateReceipt(c);
}
static void generateReceipt(Cahier c)
{
// Write the necessary code that will generate a customer’s receipt.
// The output must be displayed in a scrollable pane
}
}

Description of the output:
The output should be displayed in a scrollable pane, and have the following features:
• The first line displays the name of the establishment.
• Second line reads something like this: Welcome – thanks for stopping, followed by the current date
• The list of items displayed, one item per line – That is, the name of the product and price,
• The sum of all the items
• The number of items purchased
• The average price for each item
• The amount of money tendered
• The amount of change in $ and cents
• The change given in coin denominations

Here is an example of the form of how the output should be ( except that this output must be displayed in a scrollable pane).

Bread............ 2.99
Chicken..........6.79
Egg..................3.07
______________
Total ……….$12.85

The number of items purchased is 3 items
The average price per item is $4.28

Amount tendered is $20.00
The change is $7.15

The change includes
7 dollars
0 quarters
1 dimes
1 nickels
0 cents

NB: Use the class GetData to enter the data. This means that your program MUST consist of three classes: GetData.java, Cashier.java, and TestCashier.

Explanation / Answer

Write a class called Cashier that directs a cashier how to cash goods and give change to customers. The typical cashier operations are as follows: (a) Clear the cash register machine. (b) Enter the name and the price of each item in the cash registering machine. (c) The customer tenders an amount of money to pay for the goods (We assume the amount covers the total). (d) The cash machine computes: i. The number of items purchased ii. The total amount of purchase iii. The average price of each item iv. The number of coin denominations that the customer should receive. That is, the number of silver dollars, quarters, dimes, nickels, and cents the customer should receive in turn. In addition. Here is a what I have class TestCashier { public static void main(String[] arg) { Cashier c = new Cashier(); String name = GetData.getWord(“Enter name of item”); double price = GetData.getDouble(“Enter price of item”); c.add(name, price); name = GetData.getWord(“Enter name of item”); price = GetData.getDouble(“Enter price of item”); c.add(name, price); // Add a two more entries of your own // Now average the price of the items c.average(); // Make payment double amount = GetData.getDouble(“Enter amount of money for payment”); c.tendered(amount); // For example twenty dollars were tendered c.makeChange(); generateReceipt(c); } static void generateReceipt(Cahier c) { // Write the necessary code that will generate a customer’s receipt. // The output must be displayed in a scrollable pane } } Description of the output: The output should be displayed in a scrollable pane, and have the following features: • The first line displays the name of the establishment. • Second line reads something like this: Welcome – thanks for stopping, followed by the current date • The list of items displayed, one item per line – That is, the name of the product and price, • The sum of all the items • The number of items purchased • The average price for each item • The amount of money tendered • The amount of change in $ and cents • The change given in coin denominations Here is an example of the form of how the output should be ( except that this output must be displayed in a scrollable pane). Bread............ 2.99 Chicken..........6.79 Egg..................3.07 ______________ Total ……….$12.85 The number of items purchased is 3 items The average price per item is $4.28 Amount tendered is $20.00 The change is $7.15 The change includes 7 dollars 0 quarters 1 dimes 1 nickels 0 cents NB: Use the class GetData to enter the data. This means that your program MUST consist of three classes: GetData.java, Cashier.java, and TestCashier.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote