Lab Exercise. (p 104/4.6) Write a program that calculates the entry fee for the local art museum. The fee is calculated as follows: children under 5 yearss, free; adults 65 years and older, $1.50; all others, $2.50. Your program should display the entryFee (of type double) based on the variable ageOfEntrant (of type int).
//File: Museum.java
import CSLib.*;
public class Museum
{
public void entranceFee()
{
//Constants
final double
KID
= 0.0,
ADULT = 2.5,
SENIOR = 1.5;
double fee;
InputBox in = new InputBox();
in.setPrompt("How old are you? ");
int age = in.readInt();
//Figure out how much to charge
if (age < 5) //if you're a
kid
fee = KID;
else if (age >= 65) //if
you're a senior citizen
fee = SENIOR;
else //if you're an adult
fee = ADULT;
//Output the results
OutputBox out = new
OutputBox("Museum Fee");
out.println ("Since your age is " +
age + ", your entrance fee is $ " + fee);
}
}
Upon executing the MuseumClient program, we get:

