Code: Select all
import java.util.Scanner;
import java.util.InputMismatchException;
public class Paint1 {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double wallHeight = 0.0;
double wallWidth = 0.0;
double wallArea = 0.0;
double gallonsPaintNeeded = 0.0;
final double squareFeetPerGallons = 350.0;
do {
System.out.println("Enter wall height (feet): ");
try {
wallHeight = scnr.nextDouble();
throw new InputMismatchException();
} catch (InputMismatchException exc) {
System.out.println("Invalid input. Please try again.");
wallHeight = scnr.nextDouble();
}
} while (wallHeight
Mobile version