Question: The printConversion ( ) method should take a string ( footToMeter or meterToFoot ) to specify the type of conversion and a value

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 =10, it should print 10 feet is 3.05 meters.
If the input is "meterToFoot" and value =10, it should print 10 meters is 32.79 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.printConversion("footToMeter",10);
yourClassVariable.printConversion("meterToFoot",10);
yourClassVariable.printConversion("aWrongEntry",10);
Expected output:
10.0 feet is 3.050 meters.
10.0 meters is 32.790 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 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 Programming Questions!