/**
 * Compares if statement with while statement.
 *
 * @author Terry Sergeant
 * @version In Class Demo
 *
 * The partial program below asks the user to enter hours worked
 * If their answer is outside the proper range you should ask them
 * again.  
 * 
 * 1. Construct the if statement so that if the user enters a value
 *    outside the range of 0 to 168, it prompts the user to enter the
 *    value again.
 * 2. Test it several ways (including boundary conditions).
 * 3. Test it by giving two consecutive bogus entries (see the problem?).
 * 4. Replace the word "if" with the word "while".
 * 5. Test it some more ... get it?
 * 
*/

import java.util.Scanner;

public class IfWhile
{
	public static void main(String [] args)
	{
		Scanner cin= new Scanner(System.in);  // input from console
		double hours;
	 
		System.out.print("How many hours did you work? (0..168): ");
		hours= cin.nextDouble();

		if (false)
		{
			System.out.print("How many hours did you work? (0..168): ");
			hours= cin.nextDouble();
		}

		System.out.println("You worked "+hours+" hours!");
	}
}

