Reference no: EM132168425
Using the Design Recipe and NetBeans, construct an algorithm, and then write a Java program based on the algorithm, to solve each of the following problems:
Science: calculating energy) 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 (M) 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, temperatures are in degrees Celsius, and energy Q is measured in joules. Make sure your program declares and uses a named constant for the term 4184.
Sample Run (user input in color):
run:
Enter the amount of water in kilograms: 55.5
Enter the initial water temperature: 3.5
Enter the final water temperature: 10.5
The energy needed is 1625484.0
BUILD SUCCESSFUL (total time: 10 seconds)