Please help me Object and Instance Before attempting this assignment, be sure you have completed all the
Fantastic news! We've Found the answer you've been seeking!
Question:
Please help me
Transcribed Image Text:
Object and Instance Before attempting this assignment, be sure you have completed all the reading assignments, non- graded exercises, discussions, and assignments to date. Overview This assignment consists of two classes that will be implemented. A Weight.java class that has three private variables, two private methods and four public methods and a Project.java class that has three private methods. The goal of this assignment is to perform calculations using Weight objects (instances of Weight class). Weight Class Weight class should have three private variables, two private methods and four public methods. Variables Hint: How should/can you access these private variables? 1. A private constant variable called OUNCES_IN_A_POUND that defines the number of ounces in a pound (16). 2. A private variable called pounds with a data type of integer. 3. A private variable called ounces with a data type of double. Methods 1. A public parameterized constructor, which initializes the private variables. public Weight (int pounds, double ounces) { // implementation } 2. A private instance method called toOunces with a return type of double. This method has no parameters and should return the total number of ounces. For full credit, reuse this method across other methods when possible. 3. A private instance method called normalize with a return type of void. This method has no parameters and should ensure that the number of ounces is less than the number of ounces in a pound. For full credit, reuse this method across other methods when possible. Object and Instance Before attempting this assignment, be sure you have completed all the reading assignments, non- graded exercises, discussions, and assignments to date. Overview This assignment consists of two classes that will be implemented. A Weight.java class that has three private variables, two private methods and four public methods and a Project.java class that has three private methods. The goal of this assignment is to perform calculations using Weight objects (instances of Weight class). Weight Class Weight class should have three private variables, two private methods and four public methods. Variables Hint: How should/can you access these private variables? 1. A private constant variable called OUNCES_IN_A_POUND that defines the number of ounces in a pound (16). 2. A private variable called pounds with a data type of integer. 3. A private variable called ounces with a data type of double. Methods 1. A public parameterized constructor, which initializes the private variables. public Weight (int pounds, double ounces) { // implementation } 2. A private instance method called toOunces with a return type of double. This method has no parameters and should return the total number of ounces. For full credit, reuse this method across other methods when possible. 3. A private instance method called normalize with a return type of void. This method has no parameters and should ensure that the number of ounces is less than the number of ounces in a pound. For full credit, reuse this method across other methods when possible.
Expert Answer:
Answer rating: 100% (QA)
Code Weightjava a class that represents a Weight in pounds and ounces class Weight private instance variables private int pounds private double ounces a private named constant that defines the number ... 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
-
With reference to applicable and relevant law (common law/statutory law) of the Republic of Namibia , and or the rules of the Law society - Mention 15 (fifteen) financial activities/transactions/...
-
Molybdenum forms a substitutional solid solution with tungsten. Compute the weight percent of molybdenum that must be added to tungsten to yield an alloy that contains 1.0 10 22 Mo atoms per cubic...
-
Spieth Corporation reported taxable income of $500,000 from operations this year. The company paid federal income taxes of $170,000 on this taxable income. During the year, the company made a...
-
Explain how to solve x 2 + 6x + 8 = 0 using factoring and the zero-product principle.
-
XCBob, Inc. is an online motorcycle and ATV parts business from the owners home. XCBob entered into oral agreements with the defendant, Ed Tucker Distributers, for purchases of various materials to...
-
Price and efficiency variances, journal entries. The Monroe Corporation manufactures lamps. It has set up the following standards per finished unit for direct materials and direct manufacturing...
-
Various tools are available for developing and managing an auditing project plan and associated elements of an audit. Which tool is designed to enable an auditor to track audit deficiencies and areas...
-
Our purchase order terms are 1% 10 Net 30, this means: Question 7 options: We have to pay 1% up front. We have to pay 1% in 10 days. Customer will pay us 1% if we ship in 10 days. Supplier will pay...
-
What are the specific aims and purposes of criminal law?
-
A business owner is charged a one-time monthly fee of $10.00 plus $0.039 per minute of calls received via a toll-free number. During one month, the owner received 100 toll-free calls that lasted an...
-
What are the roles of keystone species, foundation species, and ecosystem engineers in shaping ecosystem structure, function, and biodiversity, and how do these species contribute to ecosystem...
-
At the beginning of July, Alpha Industrial, which produces a single product, had no units in inventory. Fixed manufacturing costs were $72,000. Production was 20,000 units, but only 12,000 units were...
-
opper Corporation was founded by Trevor Williams. Williams had 500,000 shares of stock, full vested. On January 1, 2011, four employees were hired, each getting 75,000 shares of unvested stock, which...
-
James, an investor who is actively looking for the opportunity to gain from arbitrage. He acquires the following quotes from three different banks. Bank A is willing to buy or sell Japanese yen at an...
-
The diagram shows the two forces acting on a small object. Which of the following is the resultant force on the object? A. 8 N downwards B. 8 N upwards C. 2 N downwards D. 2 N upwards 3 N 5 N
-
Greg died on July 1, 2012, and left Lea, his wife, a $50,000 life insurance policy which she elects to receive at $5,000 per year plus interest for 10 years. In the current year, Lea receives $6,200....
-
Yolanda is a cash basis taxpayer with the following transactions during the year: Cash received from sales of products........................................................................$65,000...
-
During 2012, Tom sold Sears stock for $10,000. The stock was purchased 4 years ago for $13,000. Tom also sold Ford Motor Company bonds for $35,000. The bonds were purchased 2 months ago for $30,000....
-
What is the half-life of uranium-238?
-
Who discovered that energy and mass are two different forms of the same thing?
-
Is it possible for a hydrogen nucleus to emit an alpha particle? Why? (a) yes, because alpha particles are the simplest form of radiation (b) no, because it would require the nuclear fission of...
Study smarter with the SolutionInn App