Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

imageimageimage

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

Step: 1

Solutions 1 Person class is created with the constructor and the settergetter for the class properti... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What two factors determine the amount of EFN?

Answered: 1 week ago

Question

Describe ERP and how it can create efficiency within a business

Answered: 1 week ago

Question

Why does this person have this want or need?

Answered: 1 week ago

Question

What does this person want or need from me?

Answered: 1 week ago

Question

4.3 Describe the five stages of active listening

Answered: 1 week ago