You are the manager of the Desert State Park. You will create a program to calculate the camping fees for each camper. Program Specifications: a. Create a folder named Nested If Program 01. Save the Java file as StatePark. b. Input consists of the camper’s name, residency code (R - Resident or N - Non-resident), and the number of days camping. Sample input is illustrated on page 2. Input will be entered from the keyboard. This program will process one record and only one record at a time. c. The camping fees are determined as follows: If the camper is a state resident, the cost for the first seven days is 7.95 per day. After seven days, the cost drops to 5.95 per day. If the camper is a non-resident of the state, the cost is 9.95 per day, regardless of the number of days. If there is an error in the input record and the residency code contains neither an R (resident) nor an N (non-resident), the cost is 12.95 per day and the value UNKNOWN is printed for the residency. d. The output will consist camper’s name, the residency words (Resident, Non-Resident, or Unknown), days camping, and the total camping fee. Display the fees with a dollar sign. The data displayed on the screen should be written on separate lines with a column heading identifying the data. There should be blank lines between the input data and the output data that is displayed on the screen. e. You decided on the appropriate data types and variable names. Named constants must be used in the program. This program should contain only one nested if statement.
You are the manager of the Desert State Park. You will create a
camping fees for each camper.
Program Specifications:
a. Create a folder named Nested If Program 01. Save the Java file as StatePark.
b. Input consists of the camper’s name, residency code (R - Resident or N - Non-resident),
and the number of days camping. Sample input is illustrated on page 2. Input will be
entered from the keyboard. This program will process one record and only one record at a
time.
c. The camping fees are determined as follows: If the camper is a state resident, the cost for
the first seven days is 7.95 per day. After seven days, the cost drops to 5.95 per day. If the
camper is a non-resident of the state, the cost is 9.95 per day, regardless of the number of
days. If there is an error in the input record and the residency code contains neither an R
(resident) nor an N (non-resident), the cost is 12.95 per day and the value UNKNOWN is
printed for the residency.
d. The output will consist camper’s name, the residency words (Resident, Non-Resident, or
Unknown), days camping, and the total camping fee. Display the fees with a dollar sign.
The data displayed on the screen should be written on separate lines with a column
heading identifying the data. There should be blank lines between the input data and the
output data that is displayed on the screen.
e. You decided on the appropriate data types and variable names. Named constants must
be used in the program. This program should contain only one nested if statement.
Step by step
Solved in 3 steps with 1 images