Question: Write a program that asks the user to enter a distance in feet (use double data type). Next call 3 methods to perform the following:

Write a program that asks the user to enter a distance in feet (use double data type). Next call 3 methods to perform the following: convert feet to inches, convert feet to kilometers, and convert feet to miles. Make sure to use a loop to ask the user for feet and do the conversions until the user enters -1 (sentinel) to stop the program. Write these methods in the program for these tasks:

convertToInches method: This method should accept feet as an argument and return the answer in inches (2 decimal places). Use the formula: inches = feet/12

convertToKilometers method: This method should accept feet as an argument and return the answer in kilometers (2 decimal places). Use the formula: kilometers = feet/3281

convertToMiles method: This method should accept feet as an argument and return the answer in miles (2 decimal places). Use the formula: miles = feet/5280

Display the 3 converted answers.

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 Databases Questions!