Question: 1. Unit conversions (30 points) a. Write a function that can convert miles to kilometers or kilometers to miles. b. Pass two parameters to this

 1. Unit conversions (30 points) a. Write a function that can

1. Unit conversions (30 points) a. Write a function that can convert miles to kilometers or kilometers to miles. b. Pass two parameters to this function: i. A parameter of type double that represents the value to be converted. ii. A parameter of type int that indicates whether the conversion is from kilometers to miles or miles to kilometers. (Look up the conversion factors using the internet or the library.) ii. Use an if...else statement with the second parameter to determine whether to convert from miles to kilometers or kilometers to miles. C. In main(), call the above function to print the following speeds in both miles per hour (mph) and meters per second (m/s) with one decimal place. (There are 1000 meters in a kilometer. Don't forget to convert seconds to/from hours.) For example, if 29 mph were given, you should print something like: "29.0 mph is equal to 13.0 m/s" or if 13.0 m/s were given you should print something like: "13.0 m/s is equal to 29.0 mph." 10.5 m/s 35 mph 3.2 m/s 73.1 mph 159.7 m/s

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!