Create a program that repeatedly converts temperatures from Celsius to Fahrenheit until a negative Celsius value is entered. Fill the blanks in the code to complete the temperature converter. How can you make this program work as described?
While and do-while loops
Chilling halt to a warm conversion
Report a typo
Fill in the gaps with the relevant elements
public class CelsiusToFahrenheit {
public void main(String[] args) {
java.util.Scanner scanner = new java.util.Scanner(System.in);
celsius = scanner.nextDouble();
(celsius >= 0) {
double fahrenheit = (celsius * 9 / 5) + 32;
System.out.printf("%.1f°C = %.1f°F\n", celsius, fahrenheit);
celsius = scanner.nextDouble();
}
scanner.close();
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.