Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Language Create a package named lab2 (no spaces, ALL in lowercase ) where you will place your lab files. Write a class named LengthConversion
Java Language
- Create a package named lab2 (no spaces, ALL in lowercase) where you will place your lab files.
- Write a class named LengthConversion with the following methods:
- metersToFeet that converts length from meters to feet. The conversion formula from meters to feet is f = 3.28084 * m , where m is the number of meters, and f is the number of feet. The method will return a string with the converted rounded length measurement in feet and inches (e.g. for m = 1.75, your method will return the string 5' 9" ).
- feetToMeters that converts length from feet to meters. The conversion formula is m = 0.3048 * f , where m is the number of meters, and f is the number of feet . The method will ask the user for the feet, then the inches, convert the values accordingly and return a string with the result in meters (e.g. for feet = 6 and inches = 2 your method will return the string 1.8796 m)
- main that will show a menu to the user and ask what length they want to convert: (1) from meters to feet or (2) feet to meter. Then your app will ask the user for the appropriate input, store it in a variable(s) of appropriate type, pass them as an argument to the corresponding method, and display the results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started