Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package paint;
- import java.util.Scanner;
- public class paint {
- 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;
- int x = 1;
- final double squareFeetPerGallons = 350.0;
- // Implement a do-while loop to ensure input is valid
- do {
- try {
- // Prompt user to input wall's height
- System.out.println("Enter wall height (feet): ");
- wallHeight = scnr.nextDouble();
- if (wallHeight > 0) {
- x = 2;
- }
- }
- catch(Exception e) {
- System.out.println("Please enter a valid number");
- wallHeight = scnr.nextDouble();
- }
- } while(x == 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement