Assignment 1
Problem Description:
Write a program that calculates the energ
Assignment 1
Problem Description:
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. If water weight is negative number, the following message should be displayed: “Water amount cannot be negative number!”
The formula to compute the energy is:
result = waterWeight * (finalTemperature – initialTemperature) * 4184
Here is a sample run
Sample 1:
Enter the amount of water in kilograms: 55.5
Enter the initial temperature: 3.5
Enter the final temperature: 10.5
The energy needed is: 1625484.0
Sample 2:
Enter the amount of water in kilograms: -8
Water amount cannot be negative number!
Analysis:
(Describe the problem including input and output in your own words.)
Design:
(Describe the major steps for solving the problem.)
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
[Copy and Paste Your program here]
Testing: (Describe how you tested this program). Include Full Screen Shot(s).
Make Sure you Name the project as Computer programming and package Name As Assignment1.Use eclipse for the code execution.
Leave a Reply