Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need help please Problem 3: You are working at Amazon.sa and you are asked by your manager to design a class for product items
i need help please
Problem 3: You are working at Amazon.sa and you are asked by your manager to design a class for product items sold at Amazon.sa. . A) Based on your experience, you decide to have the following design for the requested class: Class Name: Saleltem Fields: Serial number (type int): This field is named: ser_num Unit price (type double): This field is named: unit_price Product name (type String): This field is name: prod_name Number of available items (type int): This field is named: num_items Constructors: Full-argument constructor No-argument constructor Copy constructor Getter and setter methods for each of the above fields. Override the toString() method to return the following String message: Sale Item with serial number 123 is called Mexican Hat and costs 150.5 SAR. 250 units are available in the store Note: This is a sample output for a Saleltem object with the following fields: ser_num: 123 unit_price : 150.5 prod_name : Mexican Hat num_items : 250 Override the equals() method to compare two product items based on their serial numbers. The method should return true if both product items have the same serial number and false otherwise. B) Write a test or a driver class called: Test_ Saleltem. Create two objects of Saleltem class with the following details: Object 1 ser_num: 123 unit_price : 150.5 prod_name : Mexican Hat num_items: 250 Object 2 ser_num: 156 unit_price: 0.5 prod_name : HB2 Pencil num_items : 1450 Then, create a third object based on the second object using the copy constructor of Saleltem class. Print the content of the 3 objects. Update the unit price of the second object to 1.25. Compare the second and third objects. If both objects are identical, display the following message: We have two identical sale items! Kindly update the system records! In case, the objects are different, you should print the following message: We have different sale items! No need to update the system records! Important Notes: Submit the two Java files (Saleltem.java and Test_Saleltem.java) through LMS. Do NOT submit a zip or rar file. ONLY THE JAVA SOURCE FILES!!! Stick to the class names are specified in this document! DO NOT CHANGE THE CLASSES' NAMES OR METHODS' NAMESStep 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