Question: Write code in java. Create a class that will be used to hold measurement in feet, inches, yards, meters and centimeters. Use constant fields for

Write code in java.

Create a class that will be used to hold measurement in feet, inches, yards, meters and centimeters.

Use constant fields for the conversions. These constants can be assigned value when the fields are declares, since they are non-changing every time an instance is created. Write two constructor methods: the no-args which set the fields to zero and a second constructor that does take arguments.

Write five set( ) methods and five get( ) methods, one for each field.

Write a toString( ) method.

Create a second class named Driver. This class will have only one method And no fields. The only method in this Driver class is main( ).

In main( ) create an instance of your measurement class using the no-args constructor. Then in a loop provide the user a chance to set whichever field they chose. Make this looks good to the user, a menu would be best. Every Change the user enters requires a call to a set( ) method. Be sure your set( ) methods ensure ALL the fields are consistent. For each iteration of the loop, call the toString( ) method in a print statement to print the state of the measurement object.

The loop should repeat as long as the user wants to continue.

Once the loop exits, print a good-bye message.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!