Simple Expressions 6

Description

Using basic expressions, receiving user input, display values of different data types.

Requirements

  1. A plane flight has 8 first class seats, 12 business class seats, and 180 economy seats. The flight will have 2 pilots and 3 flight attendants.
  2. Notice below that the names and types of the variables have not been provided for you; you must determine the best data types and good, meaningful variable names.
  3. Ask the user to enter how many first class passengers there will be on the flight. You will need to create a variable for this data
  4. Ask the user to enter how many business class passengers there will be on the flight. You will need to create a variable for this data
  5. Ask the user to enter how many economy passengers there will be on the flight. You will need to create a variable for this data
  6. As you enter test data for each of first, business and economy classes, only enter data that is less than or equal to the numbers given in step 1. YOU DO NOT NEED TO CHECK AND PREVENT AGAINST ENTERING INVALID DATA — JUST DON’T ENTER IT AS USER INPUT. (Don’t enter more than 8 for first class, more than 12 for business, etc)
  7. Ask the user to enter a string that represents a departure city. You will need to create a variable for this data
  8. Ask the user to enter a string that represents a destination city. You will need to create a variable for this data
  9. For extra credit, allow the user to enter city names that have spaces in them. For example, Los Angeles
  10. NOTES: In calculating the “fullness” of the plane, calculate the percentage based on the number of passengers (See Sample Interaction). “Souls” on a flight refer to the total number of people on board.
  11. After the user input, display the resulting information as shown in the Sample Interaction below

DO NOT USE

You may not use any conditional constructs such as the IF statement

Sample Interaction / Output

How many first class passengers are boarding: 8
How many business class passengers are boarding: 5
How many economy class passengers are boarding: 172

Enter departure city: Denver 
Enter destination city: Dallas

The flight from Denver to Dallas will have 185 passengers (190 souls on board) and will be 92.5% full. 

LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT

CATALOG ID: CPP-EXP0006

Print Requirements