0% found this document useful (0 votes)
5 views

PT Java Unique System 4th Quarter Antonio

Uploaded by

vince.schmode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

PT Java Unique System 4th Quarter Antonio

Uploaded by

vince.schmode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Vincent Aaron Antonio APRIL 4, 2024

11 - ICT PROGRAMMING A JAVA 2

2 in 1 Temperature Calculator

public class TempCalcu {


public static void main (String [] args){
Scanner scan = new Scanner (System.in);
double total = 0, total2 = 0, total3 = 0, total4 = 0, total5 = 0, total6 = 0, result = 0, totals = 0;
double f1 = 0, f2 = 0, f3 = 0, f4 = 0, f6 = 0, f7 = 0, f9 = 0, f10 = 0;
System.out.println("2 in 1 Temperature Calculator");
System.out.println("Celsius(°C) and Fahrenheit(°F)");
System.out.println("If °C is higher than °F then (°F to °C) first, If °F is higher than °C then
(°C to °F) first.");
System.out.println("\n");

System.out.print("Enter °C to convert to °F: ");


double celsius = scan.nextDouble();
System.out.print("Enter °F to convert it °C: ");
double fahrenheit = scan.nextDouble();

System.out.println("\n");

if(celsius < fahrenheit){


System.out.println("Calculating...");
System.out.println("°C to °F");

for(double solve = 1; solve <= 8; solve++){


total = total + solve;
}
for(double solve1 = 1; solve1 <= 7; solve1++){
total6 = total6 + solve1;
total2 = total - total6 + 0.5;
total3 = celsius * total2;
}

for(double semifinal = 5; semifinal == 5; semifinal++){


total4 = totals + semifinal;
total5 = total3 / total4;
result = total5 + celsius;

}
System.out.println("Converting: " + celsius + "°C");
System.out.println("1 : " + total);
System.out.println("2 : " + total2);
System.out.println("3 : " + total3);
System.out.println("4 : " + total4);
System.out.println("5 : " + total5);
System.out.println("Result: " + String.format("%.1f",result) + "°F");

System.out.println("\n");

System.out.println("Calculating...");
System.out.println("°F to °C");

f9 = fahrenheit - 32;
for(double f = 5; f == 5; f++){
f1 = f2 + f;
f3 = f9 * f1;
}
for(double f11 = 1; f11 <= 7; f11++){
f10 = f10 + f11;
}
for(double f8 = 1; f8 <= 8; f8++){
f4 = f4 + f8;
f6 = f4 - f10 + 0.5;
f7 = f3 / f6;

}
System.out.println("Converting: " + fahrenheit + "°F");
System.out.println("1 : " + f9);
System.out.println("2 : " + f3);
System.out.println("3 : " + f6);
System.out.println("Result: " + String.format("%.1f",f7) + "°C");

}else if (celsius > fahrenheit){


System.out.println("Calculating...");
System.out.println("°F to °C");
f9 = fahrenheit - 32;
for(double f = 5; f == 5; f++){
f1 = f2 + f;
f3 = f9 * f1;
}
for(double f11 = 1; f11 <= 7; f11++){
f10 = f10 + f11;
}
for(double f8 = 1; f8 <= 8; f8++){
f4 = f4 + f8;
f6 = f4 - f10 + 0.5;
f7 = f3 / f6;

}
System.out.println("Converting: " + fahrenheit + "°F");
System.out.println("1 : " + f9);
System.out.println("2 : " + f3);
System.out.println("3 : " + f6);
System.out.println("Result: " + String.format("%.1f",f7) + "°C");

System.out.println("\n");

System.out.println("Calculating...");
System.out.println("°C to °F");

for(double solve = 1; solve <= 8; solve++){


total = total + solve;
}
for(double solve1 = 1; solve1 <= 7; solve1++){
total6 = total6 + solve1;
total2 = total - total6 + 0.5;
total3 = celsius * total2;
}

for(double semifinal = 5; semifinal == 5; semifinal++){


total4 = totals + semifinal;
total5 = total3 / total4;
result = total5 + celsius;

}
System.out.println("Converting: " + celsius + "°C");
System.out.println("1 : " + total);
System.out.println("2 : " + total2);
System.out.println("3 : " + total3);
System.out.println("4 : " + total4);
System.out.println("5 : " + total5);
System.out.println("Result: " + String.format("%.1f",result) + "°F");

}else{
System.out.println("Invalid (please enter a number)");

}
}
}

You might also like