I’m trying to write code that will decrement the boiling point of water based on the altitude from sea level. I was getting errors in the for loop due to lack of initialisation and incompatible values but that has been solved. Despite this, I still receive an error message when compiling except it gives me no info on what or where the issue is.
import java.util.Scanner;
public class WaterState {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int WaterBoil = 100;
int Temp = 0;
int Alt = 0;
int AltRise = 300;
int WaterFreeze = 0;
System.out.println("What is the temperature(degrees Celsius)?");
String TempStr = scan.nextLine();
Temp = Integer.parseInt(TempStr);
System.out.println("What is the altitude(metres above sea level)?");
String AltStr = scan.nextLine();
Alt = Integer.parseInt(AltStr);
for(Alt = Alt - AltRise;Alt > 0; WaterBoil = WaterBoil - 1) {
System.out.printlnp("Water boiling point is ", +WaterBoil);
}
New contributor
Operator0808 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3