Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago