Question: QUESTION The Dixie Chicken Restaurant wants you to write a program that simulates a simple cash register. The program should ask the user to enter

QUESTION

  1. The Dixie Chicken Restaurant wants you to write a program that simulates a simple cash register. The program should ask the user to enter the price of the meal. Then, the program should calculate the sales tax (8.25% of the meal price) and add it to the meal price to obtain the total price. A discount of 5% is given if the total price of the meal is more than RM100.00. The user is given the option whether to continue with the next transaction or quit the program. If the user chooses to continue, then, data will be entered again until the user chooses to stop the system. When the user chose to exit from the system, then the entered data will be displayed. The sample output can be illustrated below: (Just ignore about the tendered amount. Just refer to the sample ouput below)

The format of input and output is as follows (The bold texts indicates the data that you need to input from keyboard):

Please enter meal price = RM 200

Do you want to continue? Please enter 1(continue) or -1 (stop) = 1

Please enter meal price = RM 50

Do you want to continue? Please enter 1(continue) or -1 (stop) = 1

Please enter meal price = RM 100

Do you want to continue? Please enter 1(continue) or -1 (stop) = -1

Price Tax Total Price Discount Net Price

200.00 16.50 216.50 10.83 205.68

50.00 4.13 54.13 0.00 54.13

100.00 8.25 108.25 5.41 102.84

  1. The program implements five methods as follows:
  1. public static double calculateTax(double price)

This method will calculate a tax based on the entered price. The method has a parameter namely price and it will return tax at the end of this method implementation.

  1. public static double calculateTotalPrice(double price, double tax)

This method will get the total price based on the two parameters namely price and tax. This method will return the total price.

  1. public static double calculateDiscount(double total)

This method will compute the discount based on the total price. The parameter named total is a total price. This method will return the discount at the end of this method implementation.

  1. public static double calculateNetPrice(double total, double discount)

This method will get the result of net price based on the given two parameters namely total and discount. The total refers to the total price while the discount refers to the discount that returned by the calculateDiscount() method. The net price will be returned at the end of this method.

  1. public static void displayAllTransaction(double [] price, double [] tax, double [] total, double [] discount, double [] net)

This method will display all the transaction details that entered and calculated by the system. This method has five parameters that you need to display. The datatype for all these parameters are array that need to be declared in double. You must format those number in two decimal points using printf() method.

  1. You need to complete the codes in the five methods. Those methods will be called in the main() method.

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!