Question: Write a class that contains the following three methods: / * Convert from feet to meters * / public static double footToMeter ( double foot
Write a class that contains the following three methods:
Convert from feet to meters
public static double footToMeter double foot
Convert from meters to feet
public static double meterToFoot double meter
Print conversion result
public void printConversionString conversionType, double value
The formula for the conversion is:
Meter foot
Foot meter
Instructions:
The printConversion method should take a string footToMeter or "meterToFoot" to specify
the type of conversion and a value for conversion, then print the result.
For example:
If the input is "footToMeter" and value it should print feet is meters.
If the input is "meterToFoot" and value it should print meters is feet.
If the input is not "footToMeter" nor "meterToFoot", it should print Invalid conversion type. Please
use footToMeter or meterToFoot
Test your code using the following lines in your main method:
yourClassVariable.printConversionfootToMeter;
yourClassVariable.printConversionmeterToFoot;
yourClassVariable.printConversionaWrongEntry;
Expected output:
feet is meters.
meters is feet.
Invalid conversion type. Please use footToMeter or meterToFoot
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
