go to previous page   go to home page   go to next page hear noise

Answer:

The program runs. However, it is not clear what negative values mean in this situation. The program could be improved by calling the user's attention to possibly erroneous data.


Insulated Wall Problem

To meet building code requirements, outside walls of new houses must be well insulated. Say that the building code requires outside walls to be insulated with at least 4 inches of fiberglass batting or with at least 3 inches of foam insulation.

Here is a program that asks for the number of inches of fiberglass and the number of inches of foam and determines if a new house meets the building code.


import java.util.Scanner;
class HotHouse
{
  public static void main (String[] args) 
  { 
    Scanner scan = new Scanner( System.in ); 
    int fiber, foam ; 

    // get the inches of fiber
    System.out.println("How much fiber?");
    fiber = scan.nextInt() ;  

    // get the inches of foam
    System.out.println("How much foam?");
    foam  = scan.nextInt() ;  

    // check that at least one requirement is met
    if (  ||  )
      System.out.println("House passes the code requirements!" );
    else
      System.out.println("House fails." );

  }
}

QUESTION 20:

Fill in the blanks so that the program works correctly.