Create an instance of the weightconverter class

Assignment Help Programming Languages
Reference no: EM131321339

Test 1

You are permitted the use of pre-written notes, previous labs and the textbook. You are NOT permitted the help of the Lab TA or the Internet. Any cheating will result in a report Academic Integrity Violation and an ‘F' in the course.

Document your code with inline comments and javadoc comments. This is a majot portion of your grade.

Read this entire document before starting to write code.

Write and test a Java project that satisfies the following requirements:

Create a measurement converter project that can convert between grams, ounces, pounds and kilograms.

The constants for conversion are:

1 ounce = 28.35 grams
16 ounces = 1 pound
1 kg = 1000 grams

Write a class definition file named WeightConverter that has these fields:

weightInOunces
weightInPounds
weightInGrams
weightInKiloGrams

The class also needs the three constant fields for the conversions as listed above.

Write the following methods:

Two constructor methods:

The default constructor sets all the field values to zero except the constant. The constant is set using the conversion given above.

The overloaded constructor accepts a value for the weight of an item in pounds and calculates the values for the remaining three fields.

Write four set( ) methods that allows the user to change any measure (setOunces, setPounds, setGrams, setKiloGrams) The set methods must ensure all the fields are consistent.

Write four get( ) methods. One get method for each of the four fields (not including the constants.

Write a driver class that has the main( ) method. This main method should provide the following utility:

Create an instance of the WeightConverter class using the default values.

Write a loop that allows the user to reset any of the measures. Ask the user to enter which measure to change, read in the value and call the appropriate set method. Then print the value of each of the four fields. This process continues until the user indicates he/she wants to quit.

Once the loop exits, print a Goodbye message.

Reference no: EM131321339

Questions Cloud

Analyze ocbc bank after reading this article : Analyze OCBC Bank after reading this article. Please click on the link, then click on the "Login in as subscriber to read the full article" located at the end of the article, then login with the credentials below. Search for "Putting the 'person' ..
Each project requires net investment outlay : Assume that you are the chief financial officer at Porter Memorial Hospital. The CEO has asked you to analyze two proposed capital investments – Project X and project Y. Each project requires a net investment outlay of $10,000, and the opportunity co..
Simple harmonic motion with an amplitude : A sewing machine needle moves up and down in simple harmonic motion with an amplitude of 1.27 cm and a frequency of 2.55 Hz. What is the maximum speed of the needle? ((answer: 20.3 cm/s))
Construct the register-interference graph for the program : Devise a register-allocation strategy on the assumption that we automatically store all registers on the stack before each procedure call and restore them after the return.
Create an instance of the weightconverter class : Write a driver class that has the main( ) method. This main method should provide the following utility: Create an instance of the WeightConverter class using the default values.
Index of refraction of the soap : Calculate the minimum thickness of a soap bubble film that results in constructive interference in the time reflected light if the film is illuminated with light whose wavelength in free space is λ = 600nm. The index of refraction of the soap film..
Preparing the next section of the diversity training manual : As the new manager of human resources, you are preparing the next section of the diversity training manual, which focuses on making supervisors more aware and sensitive to religious discrimination issues.
What is the final speed of the satellite : An astronaut and a satellite are at rest when the astronaut pushes off from the satellite with a velocity 4.5 m/s (relative to the satellite). If the mass of the astronaut is 60 kg and the mass of the satellite is 3.0 x 102 kg, what is the final s..
Break-even point for the given sales mix : Prepare contribution margins as in part (1) with all revisions - Break-even point for the given sales mix and Margin of safety for the estimated sales volum

Reviews

Write a Review

Programming Languages Questions & Answers

  Create a class diagram and define the classes

Completed class diagram should show each object's encapsulated methods, the inheritance between subject and course, and the composition of students in courses.

  Include hyperlink for confirming order in online ticket

Include a check box for attending the Awards Event. Include a hyperlink for confirming the order. Make the link invisible to begin but display it after the Submit button has been clicked.

  Create project to compute checking account balance

Create a project to compute your checking account balance. Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge.

  Write a checkbook application

I have attached a zip file of what I have completed so far in this checkbook organizer program. I need to edit this program so that the transactions entered into the checkbook application are able to be double clicked and view the details from a s..

  Why small to medium sized firm implement pki solution

Why would a small to medium sized firm implement a PKI solution? What are the characteristics required in using a password that will provide security protection for a company?

  Allen has been investing in the stock market for quite some

allen has been investing in the stock market for quite some time and had some success with equity investments.recently

  Write statement to allot new value to element of array

Write down single statement which allots new value to element of ArrrayList indexed by j. This new value must be equal to twice value stored in next element of ArrayList.

  Create block using a loop to determine number of items

Create a block using a loop that will determine the number of items that can be purchased based on the price of the item and the total amount available to spend.

  Identify the different issues that may affect download time.

Choose a DTD, do not create any form elements. Note the following:

  Manage the tags associated with web resources

A product that is the tagging of web resources; it would allow the tagging, as well as the management of the tags; perhaps it would include different ways of browsing and visualizing tags (e.g., tag clouds).

  Develop a program to read in five exam-scores of a student

Develop a program to read in five exam-scores (in the range of 0-100) of a student in HIST220 class. The instructor has decided to drop the lowest of the five scores.

  Write a program that will store 7 integers

Write a program that will store 7 integers (entered by the user) into an array called list1. Next, prompt the user for 5 integers and put them into an array called list2. Now, list all of the numbers that are in BOTH lists by calling a function c..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd