Question: Using Java Language make the following 1. Create a class Person to represent a person according to the following requirements: A person has two attributes:

Using Java Language make the following

1. Create a class Person to represent a person according to thefollowing requirements: A person has two attributes: id name. a) Add aconstructer to initialize all the attributes to specific values. b) Add all

1. Create a class Person to represent a person according to the following requirements: A person has two attributes: id name. a) Add a constructer to initialize all the attributes to specific values. b) Add all setter and getter methods. 2. Create a class Product to represent a product according to the following requirements: A product has four attributes: - - - a reference number (can't be changed) a price an owner (is a person) | a shopName (is the same for all the products). a) Add a constructer without parameters to initialize all the attributes to default values (0 for numbers, "" for a string and null for object). b) Add a second constructer to initialize all the attributes to specific values. Use the keyword "this". c) Add the method changePrice that change the price of a product. The method must display an error message if the given price is negative. d) Add a static method changeShopName to change the shop name. e) Add all the getter methods. The method getOwner must return an owner.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Solutions 1 Person class is created with the constructor and the settergetter for the class properti... View full answer

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 Programming Questions!