1. Create a class Person to represent a person according to the following requirements: A person has two attributes: id

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

1. Create a class Person to represent a person according to the following requirements: A person has two attributes: id

Post by answerhappygod »

1 Create A Class Person To Represent A Person According To The Following Requirements A Person Has Two Attributes Id 1
1 Create A Class Person To Represent A Person According To The Following Requirements A Person Has Two Attributes Id 1 (84.73 KiB) Viewed 31 times
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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply