Write a complete Java program based on the UML class diagram given in Figure 1. Your program should be able to produce t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a complete Java program based on the UML class diagram given in Figure 1. Your program should be able to produce t

Post by answerhappygod »

Write A Complete Java Program Based On The Uml Class Diagram Given In Figure 1 Your Program Should Be Able To Produce T 1
Write A Complete Java Program Based On The Uml Class Diagram Given In Figure 1 Your Program Should Be Able To Produce T 1 (92.89 KiB) Viewed 19 times
please provide ans of java code txt . only 30 min left pleaseeesir/mam
please provide answer sir left
Write a complete Java program based on the UML class diagram given in Figure 1. Your program should be able to produce the output shown in Figure 3 . Figure 1: UML class diagram Implement all the classes with the instance variables (attributes) and methods specified in the diagram. The purpose of each method is as the name implies, and some of them are further explained below. Write the program based on the following tasks:
(a) Write a class named Customer. The class provides the following instance/ member variables and methods: (11 Marks) (i) Define all the attributes of the class. Note: You need to use the ArrayList (dynamic array) to declare groceriesList attribute. (1 mark) (ii) Define the constructor with arguments. Initialize all the attributes of the instance with the passed argument and/or zero value. Then, create the object from class ArrayList that is defined in Task a(i). (1 mark) (iii) Define the toString method. The method returns the following sentence: "<<< \{Customer Name\}'s grocery shopping list ≫>>. (1 mark) (iv) Define the calcItemPurchased method. The method returns the number of items purchased by a customer. (1 mark) (v) Define the buy method. The method is used to add an object from the Groceries class to 2
the groceriesList array and calculate the total price for all of the items purchased by a customer. The object added to the array represents the item purchased by a customer. (2 marks) (vi) Define the print method. The method is used to display the list and the total price of items purchased by a customer (if any) in the following format (please refer to the sample output given in Figure 3): (5 marks) Number of items purchased: 2​ Item 1 \{Information for Item 1} Item 2 { Information for Item 2} TOTAL PRICE: MYR ##.\#\#
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply