Question: I need a program that can print out a receipt for a customer in java. The local precious metal retailer is doing really good and

I need a program that can print out a receipt for a customer in java.

The local precious metal retailer is doing really good and needs a program that will allow the customer to buy more than one type of metal (up to all 5). Below is how the format of the output should look notice that it includes the customer's name along with the salesperson's initials.

The cost of per ounce is:

Type 1 --> $125.56 Type 2 --> $327.48 Type 3 --> $79.24 Type 4 --> $452.14 Type 5 --> $255.60

The amount that the person pays must have sales tax added to the Subtotal amount. Your program needs to calculate the amount that a person will pay for their metal, the sales tax that will be charged for the sale and display all results in the required format including the sales person's initials.

The sales person will enter in all the information:

  • What type of metal was bought
  • The number of ounces purchased.
  • Customer's name
  • Their name (sales person)

Your program will need to do all of the calculations for the requested output.

The output should look like the following:

Customer: Jones, Bill Salesperson: JS

-------------------------------------------------------------------- Ounces | Metal Type | Price/oz | Cost 12.6 Type3 $79.24 $998.42 3.7 Type8 $489.85 $1812.44 ---------------------------------------------------------------------- Subtotal: $2810.86 Sales Tax: $231.90 ------------------------------------------------------------------------ Sales Total: $3042.76 Here are some things that your program must have:

  1. The menu must be a separate method that all it does is print the menu
  2. There must be a separate method that receives only the subtotal and returns the amount of sales tax to be charged.
  3. You must store the metal prices in a constant array
  4. The customer can buy as much metal as they want. (not over 5 types)

other requirements:

I have to have only use if statements, loops and arrays*, but only single-dimensional arrays

the order of the bill should be in the order of how they bought it.

the menu should pop up every time (loop) and be the in a different method from the main method, the sales person would be the one theoretically putting in the information.

assume that the customer bought at least one type of metal and go through the menu process with each type. We cannot just plain out ask them "how much of each did you buy"

The output does not have to line up perfectly but only be similar.

There has to be a separate method with it receives and calculates the subtotal and return it back to the main method.

The metals can be in a constant array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!