ASSIGNMENT III

Requirements and Assumptions:
Recall that in Assignment I, you  read passenger information and showed the passenger a copy of the ticket and the cost.  See Assignment I for details. In Assignment II, you added more functionality by repeating the processing of reservation requests until the user chose to quit. Moreover, the seat assignment schemes and generation of confirmation number were enhanced. In this assignment, the project will be improved both in design and functionality.

In this assignment, all the functionality of Assignment II will remain. In addition, you will check the validity of the telephone number. The telephone number must be of the pattern   "ddd-ddd-dddd", where each 'd' should be a digit.

The confirmation number is no longer a random number. It must be the made up of first character from name, first character from address,  first digit from telephone number,  last character from name, last character from address, and last digit from the telephone number in that order.

The main menu and all other requirements of Assignment II must be met again. The additional requirement is that you should let the user know when the flight is full. However you must redesign the code into methods. See the "Internal Requirements" below.

Example Session:  The items in italics are printed by the program and items in bold are the user input.
 

Welcome to my program!!  (John Smith, Assignment III)

Pick from the following menu:

1 -- Request Reservation
2 -- Quit Program

Your Choice: 1

Welcome to Kettering International Airlines, please provide the following information to book a flight.

Name:  Saroja Kanchi
Address:  3456 Hollywood Blvd, Los Angeles, CA 90003
Telephone Number: 34k-ere-34dd

******* INVALID INPUT:  Input is not a valid  input, Please input in the format "ddd-ddd-dddd"

Telephone Number: 123-456-7890
 

Preferred Time of Flight(6AM/12Noon/ 4PM/10PM): 4 PM
Preferred Seat  (Isle/Window/None): Q

******* INVALID INPUT:  Q is not a valid  input, Please input one of I, W or N

Preferred Seat  (Isle/Window/None): W
Number of Bags to Check In: 4

Here is a copy of your ticket:

Name of Passenger:Saroja Kanchi              Address:  3456 Hollywood Blvd, Los Angeles, CA 90003          Telephone Number: 123-456-7890
Time of Flight:   4PM                                          Seat Number:   1A                                                                              Number of Bags: 4

Here are some numbers you may need to refer to your reservation.

Confirmation Number: S31I30

 Hope you have a nice flight, ( if we can find a pilot that is, .....), Bye

Pick from the following menu:

1 -- Enter Passenger Information
2 -- Quit Program

(* And the program continues from here  until the user chooses 2 *)


Internal Requirements:
1. Use as many constants as needed. Constants are declared using the keyword 'final'.  There must be a constant for LOWER_BAG_COUNT (set to 0)  and UPPER_BAG_COUNT (set to 5). There must be a constant for NUM_OF_ROWS in the flights.

4.  You need to have several methods in this program. All methods will be part of the MainClass.

5. You should try to minimize the class  variables. The (global) class variables should be those that are needed in almost all methods. I will allow you to use four global variables for the counters which keeps count of number of people booked in each flight. All constants must  be global.

6. The list of methods MUST  include  the following in the same format. You may have more methods than what I have given below. However, you cannot have less. You have to decide what parameter each one needs. Note that only counters
are global. Everything else needs to be sent to the methods other than the global constants ofcourse.

1) String     readTelephoneNumber (...)
(will read one a telephone number from the screen. Will not check for validity. )

2)char        readSeatPreference(...)
(similar to the above)

3)int      readNumberOfBags(...)
(similar to the above)

4)String   readName(...)
(similar to the above)
 

5)String     readAddress(...)
(similar to the above)
 

6)int    readPreferredFlightTime(...)
(similar to the above)
 

7)void   printMainMenu(...)
(will print the menu containing choice 1 and 2. )
 

8)String  generateConfirmationNumber(...)
(will generate and return the confirmation number)

9)float   computePriceOfTicket(...)
(will compute the price of the ticket. )

10)String    generateSeatAssignment(...)
(will generate the seat assignment according to the information given above)
 

11) boolean  checkValidityTelephoneNumber(String tel_no)
(will check the validity of telephone number)

12) boolean checkValidityBags (...)
(same as above)

13)boolean    checkValidityPreferredSeat(...)
(same as above)

14.) boolean checkValidityTimeOfFlight(...)

                       FOLLOW ALL STYLE GUIDE LINES AND SUBMISSION INSTRUCTIONS.
 
 

    Assignments and Labs Page  CPSC101 Homepage  Saroja Kanchi's Homepage