Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 1: Write a program which record sales transaction for a customer of Karakura Shop, calculate the total price to be paid and display the
Exercise 1: 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. a. Characterise a shop by product name, quantity and price. b. Initialise the instance variables using parameterised constructor. (2) Create a program named Assignment.java. In main() i. Invoke welcomeMenu () to display heading for quiput main screen. H. Invoke takelnput() in Input.java to read series of input values from keyboard input stream. b. In welcomeMenu(). 1. Display the following heading in the output main screen. on Command Prompt a. C:\Users\HAZ\Documents\NetBeansProjects\V3_oop WELCOME TO KARAKURA SHOP Figure 1: Output Header (3) Create a program named Input.java. a. In takeInput() 1. Record sold product name, price and quantity from keyboard input stream using a do...while loop until user opt to finish data entry. Enter product name : Difflam Enter product quantity :2 Enter product price : RM 5.00 Figure 2: Input Series ii. Invoke initList by sending the three input values as the arguments and the declared ArrayList. ii.Prompt user choice whether to continue recording input or stop the data entry. >>> Continue? :1 Figure 3: Loop Exit iv.Invoke display() by sending the ArrayList as the argument. b. c. In initList(). i. Create Shop object using the received argument to initialise the object. H. Insert the instantiated object into the received ArrayList. In display. i. Display the following heading in the output main screen. Medicine Quantity Price Figure 4: Output Heading ii. Use foreach loop to print the ArrayList. iii. Calculate and display total price for the recorded transactions. TOTAL PRICE FOR 2 ITEMS : RM 12.25 Figure 5: Output for Total Price
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