1. Create a class Person to represent a person according to the following requirements: A person has two attributes: id
Posted: Sun May 15, 2022 8:37 am
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 shop Name (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. 3. Create the class ProductTester with the main method. In this class do the following: a) Create a person pl. The person's name and id must be your name and your student Id. b) Create a product with the following information: reference = 1. price = a value from your choice. owner=pl. shopName = "SEUM c) Change the price of the product to your age. d) Change the shop name to your full name. e) Print all the information of the product.