Objectives

The goal of this assignment is to learn the following:

Computer Science Principles Curriculum

Common Core Standards

Overview

Write a small travel reservation program for a travel agency to book vacation packages for clients. The program will ask the user to pick one of the offered destinations for flights and have an option of booking a hotel room. At the end of the reservation process the program will provide the user with all of the booking information. Create a new project and name it Travel.

Description

A small travel agency in St. Louis offers vacation packages to clients in the St. Louis area. Since the travel agency is small, it offers only a small number of destinations and hotels at the selected destination. Write a program to help the travel agency make flight and hotel reservations for their clients.

The travel agency wants to know the number of travelers planning to go on the trip. Prompt the client for the number of people who will be traveling. The program should only accept the input value of one or more travelers. There is no limit for the number of travelers. If the client enters a value of zero or less, the program should reset the value to one traveler and inform the client of an error.

After the user has entered the number of travelers the program should provide a list of offered destinations with a price (per person) for each destination for the client to book a round trip flight. Prompt the client to select a destination number by entering an integer value. The program will determine which destination to get and store the correct city name and price. A list of cities with prices is shown in the table below:


Destination / Round Trip Fare
Chicago / $200.00
Los Angeles / $360.00
Miami / $320.00
Orlando / $310.00
Seattle / $330.00

The program should also test if the client entered the correct value for the destination. If the client enters a value that is not within the range of offered destinations, the program will assume that the client does not want any of the listed destinations.

After obtaining the client’s flight reservation request, the program will calculate a total price of the flight itinerary with the round trip fare and a number of travelers.

If the flight reservation has been made successfully, the program will offer the client an option of booking a hotel room. If the flights were not booked, the hotel option should be skipped. The client will be asked to book a hotel room or opt out of the hotel option. The program should ask the client the question, "Would you like to include hotel in your package (Y/N)?" Both upper and lower cases (Y, y, N, n) are acceptable. If the client chooses to include hotel in the package, the program will proceed and ask the client a couple of questions. If the client does not want to include hotel in the package, the hotel option is not included. If an incorrect value is entered, no hotel reservation will also be made.

When the client wants to include hotel in the package, the program will do the following:


______________________________________________________________________________________________________________________________________________________________________________
Hotel Type / Price
______________________________________________________________________________________________________________________________________________________________________________
Motel / $49.99
______________________________________________________________________________________________________________________________________________________________________________
Standard Hotel / $98.50
______________________________________________________________________________________________________________________________________________________________________________
Luxury Hotel / $199.75


At the end of the program, the program will determine if the reservation for flights and/or hotel is booked. The program should have the following logic:

Sample Output

The input dialog statements are included in the sample output. They are identified as [Input Dialog].

Activity:

Flights and Hotel Reservation

Welcome to the travel agency. You offer travel packages for your vacation destinations.
[Input Dialog] How many people will be traveling? 4
Select one of the destinations to book a flight: 1 - Chicago ($200), 2 - Los Angeles ($360), 3 - Miami ($320), 4 - Orlando ($310), 5 - Seattle ($330)
[Input Dialog] Enter the destination number: 3
[Input Dialog] Would you like to include hotel in your package (Y/N)? Y
What kind of hotel would you like to book? 1 - Motel ($49.99), 2 - Standard Hotel ($98.50), 3 - Luxury Hotel ($199.75)
[Input Dialog] Enter the hotel number: 2
[Input Dialog] Enter a number of hotel rooms: 1
[Input Dialog] Enter a number of nights to stay at the hotel: 3
The reservation for flights and hotel has been booked.
Total flight price to Miami for 4 traveler(s) is $1280.0
Total hotel price for 1 room(s) at Standard Hotel for 3 night(s) is $295.5
Total package price for flights and hotel is $1575.5

Flights Reservation Only

Welcome to the travel agency. You offer travel packages for your vacation destinations.
[Input Dialog] How many people will be traveling? 3
Select one of the destinations to book a flight: 1 - Chicago ($200), 2 - Los Angeles ($360), 3 - Miami ($320), 4 - Orlando ($310), 5 - Seattle ($330)
[Input Dialog] Enter the destination number: 5
[Input Dialog] Would you like to include hotel in your package (Y/N)? n
The reservation for flights has been booked.
Total flight price to Seattle for 3 traveler(s) is $990.0

No Reservation

Welcome to the travel agency. You offer travel packages for your vacation destinations.
[Input Dialog] How many people will be traveling? 1
Select one of the destinations to book a flight: 1 - Chicago ($200), 2 - Los Angeles ($360), 3 - Miami ($320), 4 - Orlando ($310), 5 - Seattle ($330)
[Input Dialog] Enter the destination number: 6
No reservation has been made. Please come back again!

Reservation With Errors and Automatic Resets

Welcome to the travel agency. You offer travel packages for your vacation destinations.
[Input Dialog] How many people will be traveling? 0
Error: The number of travelers has been reset to 1. You entered 0
Select one of the destinations to book a flight: 1 - Chicago ($200), 2 - Los Angeles ($360), 3 - Miami ($320), 4 - Orlando ($310), 5 - Seattle ($330)
[Input Dialog] Enter the destination number: 1
[Input Dialog] Would you like to include hotel in your package (Y/N)? Y
What kind of hotel would you like to book? 1 - Motel ($49.99), 2 - Standard Hotel ($98.50), 3 - Luxury Hotel ($199.75)
[Input Dialog] Enter the hotel number: 4
Error: The hotel type has been assigned to (2) Standard Hotel. You entered 4
[Input Dialog] Enter a number of hotel rooms: 0
Error: The number of hotel room has been reset to 1. You entered 0
[Input Dialog] Enter a number of nights to stay at the hotel: -1
Error: The number of nights has been reset to 1. You entered -1
The reservation for flights and hotel has been booked.
Total flight price to Chicago for 1 traveler(s) is $200.0
Total hotel price for 1 room(s) at Standard Hotel for 1 night(s) is $98.5
Total package price for flights and hotel is $298.5

Next Tutorial

In the next tutorial, we will discuss Assignment 3.2, which describes how work Number Guessing Game in Quorum..