-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjwelch_module_2.java
More file actions
35 lines (28 loc) · 1.03 KB
/
jwelch_module_2.java
File metadata and controls
35 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Scanner;
/**
* jwelch_module_2
*/
public class jwelch_module_2 {
public static void main(String[] args) {
//Setup the variables I will use
double waterMass;
double initialTemperature;
double finalTemperature;
double Q;
//setup the stupid scanner thing.
Scanner input = new Scanner(System.in);
//ask setup questions.
System.out.println("Print the number of kilos of water you are starting with: ");
waterMass = input.nextDouble();
System.out.println("What is the starting temperature in Celcius: ");
initialTemperature = input.nextDouble();
System.out.println("What is the ending temperature of the water in Celcius: ");
finalTemperature = input.nextDouble();
//close the stupid scanner
input.close();
//do calculation
Q = waterMass * ( finalTemperature - initialTemperature ) * 4184;
//output answer
System.out.println(("The result in joules is: " + Q));
}
}