Question: Write a program which record sales transaction for a customer of Karakura Shop, calculate the total price to be paid and display the purchase receipt.

Write a program which record sales transaction for a customer of Karakura Shop, calculate the total price to be paid and display the purchase receipt.

  1. Create a program named Shop.java.
    1. Characterise a shop by product name, quantity and price.
    2. Initialise the instance variables using parameterised constructor.

  1. Create a program named Assignment.java.
    1. In main()
      1. Invoke welcomeMenu () to display heading for output main screen.
      2. Invoke takeInput() in Input.java to read series of input values from keyboard input stream.

  1. In welcomeMenu(),
    1. Display the following heading in the output main screen
  1. Create a program named Input.java.
    1. In takeInput()
      1. Record sold product name, price and quantity from keyboard input stream using a dowhile loop until user opt to finish data entry.
      2. Invoke initList by sending the three input values as the arguments and the declared ArrayList.
      3. Prompt user choice whether to continue recording input or stop the data entry.
      4. Invoke display() by sending the ArrayList as the argument.

  1. In initList(),
    1. Create Shop object using the received argument to initialise the object.
    2. Insert the instantiated object into the received ArrayList.

  1. In display(),
    1. Display the following heading in the output main screen
    2. Use foreach loop to print the ArrayList
    3. Calculate and display total price for the recorded transactions.

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!