Question: QUESTION 2 - PROBLEM SOLVING Figure 1 is a class diagram that represents a complete definition and relationship of Person, Customer, Item, Material, Service, TestItem

 QUESTION 2 - PROBLEM SOLVING Figure 1 is a class diagramthat represents a complete definition and relationship of Person, Customer, Item, Material,Service, TestItem and TestCustomer classes. wwwwwwwwwww wwwwwwwww C Person C Test Customermainlangs Strings vold name: String _ String Persoriname String_String) printinfo void private- protected - public c) Customer dress: String phone String Ditem Vectoritem> Customariname String no String address String, phone: String adotemitem Remi: void

QUESTION 2 - PROBLEM SOLVING Figure 1 is a class diagram that represents a complete definition and relationship of Person, Customer, Item, Material, Service, TestItem and TestCustomer classes. wwwwwwwwwww wwwwwwwww C Person C Test Customer mainlangs Strings vold name: String _ String Persoriname String_String) printinfo void private - protected - public c) Customer dress: String phone String Ditem Vector item> Customariname String no String address String, phone: String adotemitem Remi: void printito void c Testtem C tem name: String price: double iteminame String price double! printo void omainiargs Stringi static void Material C Service man hours: double Service name String.man_hours doublel getTotale double proved spet Sering Boty it Material name String price double spec: String, aty int Totalpricell double o printide void Figure 1: Class diagram of Person, Customer, Item, Material, Service, TestItem and TestCustomer classes. WWWWWWWWWWW Two java programs (TestItem.java and Test Customer.java) have been prepared to test the Item and customer classes. Compile and run these two test programs before you proceed with the main tasks given in this question. Below is the default output of these test programs: Default output of TestItem.java: Test Material' class: Item Name: Engine Oil Price: 130.8 Test Service' class: Item Name: Engine Oil Service Price: 15.0 Item Name: Major Service Price: 15.0 Default output of TestCustomer.java: Test 'Customer' class: Name : Alice IC No.: 456 Based on the class diagram given in Figure 1. do the following two tasks: a) Complete the implementation of Material.java and Service.java source files so the TestItem.java program can produce the output as shown below: Test 'Material' class: Item Name: Engine Oil Price: 130.8 Type: MATERIAL Spec. : Semi Synthetic 15W/40 Quantity: 2 Total Price: 261.6 Test Service' class: Item Name: Engine Oil Service Price: 15.0 Type: SERVICE Man Hours: 0.5 Total Price: 15.0 Item Name: Major Service Price: 15.0 Type: SERVICE Man Hours: 2.8 Total Price: 49.5 As a guide, below is the list of implementations need to be done inside the Material.java and Service.java files: Define class/instance variable Complete the class's constructor implementation Implement getTotalPrice method Implement printInfo method . Inside the Material and service classes, the getTotalPricel) method should behaves differently as follows: Material class - Total price is simply aty * price Service class - The rate of total price is fixed at RM 15 if man hours is not more than 0.5 hours, otherwise it is rated by using the formula: 15 (man hours - 0.5) + 15 b) Complete the implementation of Customer.java source file so the TestCustomer.java test program can produce the output as shown below: Test Customer' cla33: Name: Alice IC No.: 456 Address: No. 6, KTC UTM, Johor Phone: 011-7123987 Ordered Item(s): Item Name: Engine Oil Price: 130.8 Type: MATERIAL Spec. : Semi Synthetic 15W/40 Quantity: 2 Total Price: 261.6 Item Name: Oil Filter Price: 18.3 Type: MATERIAL Spec. : Saga OEM Quantity: 2 Total Price: 36.6 Item Name: Engine Oil Service Price: 15.0 Type: SERVICE Man Hours: 0.8 Total Price: 19.5 GRAND TOTAL PRICE: 317.70 Below is the list of implementations need to be done inside the Customer.java file: . Define class/instance variable Complete the class's constructor implementation Complete the implementation of addItem method Add method to print customer info and items ordered inn

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!