HW02 Solution1

HW02 Solution1 - System.out.print"Is the water...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 import java.util.Scanner public class HW02_1 { public static void main(String args[]) { Scanner scanner = new Scanner(System.in) System.out.print("What is the water temperature in degrees C? ") double temp // Temperature temp = scanner.nextDouble() if (temp < 100) System.out.println("The water should not be boiling.") else System.out.println("The water should be boiling.")
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.print("Is the water boiling (0=no, 1=yes)? ") int isBoiling // 1=boiling, 0=not boiling isBoiling = scanner.nextInt() if (isBoiling == 1 && temp < 100 || isBoiling ==0 && temp >= 100) System.out.println("The sensor should be checked.") else System.out.println("The sensor appears to be working correctly.") } }...
View Full Document

Ask a homework question - tutors are online