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

Answer:

Yes. It is always good to test programs with values that are right at the limit.


Car Rental Problem

A car rental agency wants a program to determine who can rent a car. The rules are:

The program looks something like the cookie program:

// Rental Car Checker
//
import java.util.Scanner;
public class RenterChecker
{
  public static void main (String[] args) 
  { 
    // Declare a Scanner and two integer variables
    Scanner scan = new Scanner( System.in ); 
    int age, credit; 

    // get the age of the renter
    System.out.println("How old are you?");
    age = scan.nextInt() ; 

    // get the credit line
    System.out.println("How much credit do you have?");
    credit = scan.nextInt() ; 

    // check that both qualifications are met
    
    if (  && )
      System.out.println("Enough to rent this car!" );
    else
      System.out.println("Have you considered a bicycle?" );
  }
}

QUESTION 7:

Complete the program by filling in the blanks.

Consider carefully what relational operators to use.


go to previous page   go to home page   go to next page