Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribedimage text in transcribed

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' NAMES

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago