Write a convertToMetric class that has the following field:
standard - holds a double, standard length...
60.1K
Verified Solution
Link Copied!
Question
Programming
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) andstores it in the standard field.
setStandard - accepts a standard length in feet and stores itin standard.
getStandard - returns the value of the standard field, as alength in feet, no conversion required.
getMeters - returns the value of the standard field convertedto meters.
getCentimeters - returns the value of the standard fieldconverted to centimeters
A second class will be created and used to test the new objectclass. This, executable class, is to instantiate an object of'convertToMetric' type. Then it will allow the user to use keyboardinput to input a value for standard. That value will then beconverted to meters and centimeters, and displayed.
Make sure that your output (or display) is user-friendly oreasy to read and understand. You should display the length in feet,length in meters and length in centimeters.
Answer & Explanation
Solved by verified expert
3.9 Ratings (797 Votes)
Kindly upvote ifthis helpedOUTPUTCODE for indentationCODE as plain textimport javautilScannerpublic class ConvertToMetric double standard public double getStandard
See Answer
Get Answers to Unlimited Questions
Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!
Membership Benefits:
Unlimited Question Access with detailed Answers
Zin AI - 3 Million Words
10 Dall-E 3 Images
20 Plot Generations
Conversation with Dialogue Memory
No Ads, Ever!
Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!