Answered step by step
Verified Expert Solution
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.
- Create a program named Shop.java.
- Characterise a shop by product name, quantity and price.
- Initialise the instance variables using parameterised constructor.
- Create a program named Assignment.java.
- In main()
- Invoke welcomeMenu () to display heading for output main screen.
- Invoke takeInput() in Input.java to read series of input values from keyboard input stream.
- In main()
- In welcomeMenu(),
- Display the following heading in the output main screen
- Create a program named Input.java.
- In takeInput()
- Record sold product name, price and quantity from keyboard input stream using a dowhile loop until user opt to finish data entry.
- Invoke initList by sending the three input values as the arguments and the declared ArrayList.
- Prompt user choice whether to continue recording input or stop the data entry.
- Invoke display() by sending the ArrayList as the argument.
- In takeInput()
- In initList(),
- Create Shop object using the received argument to initialise the object.
- Insert the instantiated object into the received ArrayList.
- In display(),
- Display the following heading in the output main screen
- Use foreach loop to print the ArrayList
- Calculate and display total price for the recorded transactions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started