This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

17 lines
564 B
Java

import java.util.Scanner;
public class Exercise2 {
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
System.out.print("Enter the amount of water in kilograms:");
float M = inp.nextFloat();
System.out.print("Enter the initial temperature:");
float t1 = inp.nextFloat();
System.out.print("Enter the final temperature:");
float t2 = inp.nextFloat();
inp.close();
double Q = M * (t2 - t1) * 4184;
System.out.println("The energy needed is " + Q);
}
}