Question: CS101 | Lab 1 1) Write a program that reads a mile in a double value from the console, converts it to kilometers, and displays

CS101 | Lab 1 1) Write a program that reads a mile in a double value from the console, converts it to kilometers, and displays the result. The formula for the conversion is as follows: 1 mile = 1.6 kilometers Here is a sample run: Enter miles: 96 Enter 96 miles is 153.6 kilometers 2) Write a program that calculates the energy needed to heat water from an initial temperature to a final temperature. Your program should prompt the user to enter the amount of water in kilograms and the initial and final temperatures of the water. The formula to compute the energy is Q = M * (finalTemperature - initialTemperature) * 4184 where M is the weight of water in kilograms, initial and final temperatures are in degrees Celsius, and energy Q is measured in joules. Here is a sample run: Enter the amount of water in kilograms: 55.5 Enter Enter the initial temperature: 3.5 Enter Enter the final temperature: 10.5 Enter The energy needed is 1625484.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
