Using Java Language make the following 1. Create a class Person to represent a person according to
Fantastic news! We've Found the answer you've been seeking!
Question:
Using Java Language make the following
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Solutions 1 Person class is created with the constructor and the settergetter for the class properti... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Make a class Person to represent a person according to the following requirements: A person has two attributes: id name. Add a constructer to initialize all the attributes to specific values. Add all...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Aussie Infonautics, Inc., produces handheld Windows CE¢-compatible organizers. Aussie Infonautics markets three different handheld models. PalmPro is a soupedup version for the executive on the...
-
If AD shifts by $60 for every $1,000 change in consumer wealth, by how much will AD increase when the stock market rises in value by $400 billion?
-
The diagram shows the curve that intersects the x-axis at A. The normal to the curve at B(4, 3) meets the x-axis at C. Find the area of the shaded region. y = 2x+1
-
Crush Autosmashers can purchase a new electromagnet for moving cars at a cost of \($20,000.\) At the end of its useful life, the electromagnet will be worth \($1,000.\) If Crushs MARR is 12...
-
Stefani Company has gathered the following information about its product. Direct materials. Each unit of product contains 4.5 pounds of materials. The average waste and spoilage per unit produced...
-
3. The distance between carbon atoms in diamond is 0.154 nm. What is this distance in meters? Have Factor 0.154 nm 1 x 10^9nm Want 1.54 x 10^-10m 4. Calculate the number of grams in 32.0 lbs....
-
Bedco manufactures bed sheets and pillowcases which it supplies to a major hotel chain. It uses a just-in-time system and holds no inventories.The standard cost for the cotton which is used to make...
-
Determine the joint displacements, member end forces, and support reactions for the beam shown below using the matrix stiffness method. 100 kN 100 kN 20 kN/m 5 m 5 m 5 m 1.51 E= 30 GPa 1=4.8 (10) mm
-
Investigate the properties of eigenvalues and eigenvectors in non-symmetric matrices. Solve the Navier-Stokes equations for incompressible fluid flow in three dimensions. Investigate the convergence...
-
The dimensions of the graph are G = 16 cm to -G = -16 cm on the y-axis and 0 to H = 75 meters on the x-axis. If the frequency of the wave above is 25 Hz calculate the wave speed in m/s of the wave....
-
Question A $100,000 whole life policy is issued to a life aged 25 for a single premium due at issuance. Assume the force of mortality is a constant = 0.005 and the force of interest is d = 0.10. The...
-
You have collected three samples for lead fume using 0.8 um pore size MCE filters in closed face 37-mm cassettes with a sampling pump that you assumed was operating at a flow rate of 3.0 L/min. Each...
-
How many times would "hello" print when the following code executes? public class printHello { public static void main(String[] args) { int counter = 0; while(counter < 10) { } }...
-
A member of a colony on a Jupiter moon must salute the UN flag at the same time it is done on Earth, which is at noon in New York. If observers in all frames of inertia agree that he has done his...
-
How has the globalization of firms affected the diversity of their employees? Why has increased diversity put an additional burden on accounting systems?
-
Dr. George E. Beeper is a single taxpayer. He lives at 45 Mountain View Dr., Apt. 321, Spokane, WA 99210. Dr. Beeper's Social Security number is 775-88-9531. Dr. Beeper works for the Pine Medical...
-
Diego, age 28, married Dolores, age 27, in 2012. Their salaries for the year amounted to $46,479 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income...
-
In 2012, Lou has a salary of $54,000 from her job. She also has interest income of $1,700. Lou is single and has no dependents. During the year, Lou sold silver coins held as an investment for a...
-
Compare and contrast the conceptual and physical properties of money.
-
Compare and contrast monetary policy and fiscal policy.
-
Compare and contrast open market operations and reserve requirement.
Study smarter with the SolutionInn App