Create an Object class and a test class to accomplish the following: Write a convertToMetric class that has the following field: standard - holds a double, standard length value in feet. The class should have the following methods: Constructor - that accepts a length in feet (as a double) and stores it in the standard field. setStandard - accepts a standard length in feet and stores it in standard. getStandard - returns the value of the standard field, as a length in feet, no conversion required. getMeters - returns the value of the standard field converted to meters. getCentimeters - returns the value of the standard field converted to centimeters A second class will be created and used to test the new object class. This, executable class, is to instantiate an object of 'convertToMetric' type. Then it will allow the user to use keyboard input to input a value for standard. That value will then be converted to meters and centimeters, and displayed. Make sure that your output (or display) is user-friendly or easy to read and understand. You should display the length in feet, length in meters and length in centimeters. Submit convertToMetric.java and testConvertToMetric.java as attachments under Assignment Submission.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

Create an Object class and a test class to accomplish the following:

  • Write a convertToMetric class that has the following field:
    • standard - holds a double, standard length value in feet.
  • The class should have the following methods:
    • Constructor - that accepts a length in feet (as a double) and stores it in the standard field.
    • setStandard - accepts a standard length in feet and stores it in standard.
    • getStandard - returns the value of the standard field, as a length in feet, no conversion required.
    • getMeters - returns the value of the standard field converted to meters.
    • getCentimeters - returns the value of the standard field converted to centimeters
  • A second class will be created and used to test the new object class. This, executable class, is to instantiate an object of 'convertToMetric' type. Then it will allow the user to use keyboard input to input a value for standard. That value will then be converted to meters and centimeters, and displayed.
  • Make sure that your output (or display) is user-friendly or easy to read and understand. You should display the length in feet, length in meters and length in centimeters.

Submit convertToMetric.java and testConvertToMetric.java as attachments under Assignment Submission.

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,