This report will be based on a program that was created for an airline company. The program will be designed in Microsoft Visual Studio 2008. The airline company had stated that they required a program that allows users to book seats upon their ten seat plane. The plane is divided into two classes, first and economy class. Both of these classes hold five passengers each. First class is designed as seats 1-5 and Economy class is seats 6-10. The main objective originally was for the program to assign a seat to the user, but for a more advanced program, the program should allow the user to book the seat they require.
If the seat has been booked the program should prompt the user informing them that the seat is booked. If either or both classes are full, the program should also prompt this message. Lastly, if the user does not require booking anymore seats, the program should end with the message “The next flight leaves in three hours”. Purpose The purpose of the SHARMA AIRLINE reservation system is to make the lives of users wanting to book seats on a plain, a smooth and easy process. It will reduce the amount of customers that queue up on travel agency to reserve seats on a plane, when it can all be done at home with ease.
The Discussion The approach towards the development of this program is vital. There are many techniques that need to be taken into consideration to help the development of the program, the assignment states that there are two classes, First class (seats 1-5) and Economy Class (seats 6-10). It also states that a technique called “one dimensional array” must be used. An array is blocks of elements, these blocks of elements are placed into memory locations that are close to each other. This method is very useful for this type of program.
The reason behind this is because an array is able to store information and remember it throughout the duration of the program, so if a customer books a seat, essentially they are filling the one element in the array changing its value from 0 (non-booked) to 1 (booked). This is how I will be using arrays in my program. After highlighting key aspects of the assignment brief it is time to decide the opening of the program, the navigation around the program and data validation. For this program, it is vital that a “menu system” of such, is created.
This menu system will just consist of a few lines, prompting the user to enter integers (numbers) to navigate to different classes. The integers involved to help navigate through the program will be numbers 1 and 2. The program will also prompt the user beforehand that any other number or character that is entered in the menu system will terminate the program. After the user has made a choice of which class they would like, the program will straight away ask them which seat they would like. For this part, the data that is entered will be recognized as an integer, as they are only entering a number for their seat.
To prevent users making an error, along with the welcoming message of each class, another message is followed reinforcing again the seating arrangements of the classes. If by an accident, the user has enters a seat number that exceeds the class seating limit, a message will prompt the using, reminding them of the seating arrangements and giving them the option to try and book a seat again. This method is called data validation, ensuring that the data entered is correct, if incorrect, the program will aid them in correcting the issue.
A crucial part in this part of the development of the program was to make sure that if a user had entered a seat that exceeded the limit of the class that the program didn’t continue in booking the seat. For example, in first class, if a user entered 6 as a seat number by accident, the program will recognize that this isn’t allowed, display the error message, but still book the seat and display the message “Your seat number is : 6”. Another specification to take into account was to inform the user if a seat is taken or available.
This program achieves this specification; if a user has booked a seat, and then goes back to enter the same seat again the program will prompt the user informing them that this seat is taken. The FDD diagram (functional decomposition diagram) It is a good practice for most programmers to create a functional decomposition diagram. A functional decomposition diagram (FDD), is a diagram that programmers must be created before writing the program. This diagram is a way for the programmer to write down how they want their program to function, the process of each step of the program.
As a beginner programmer, the below FDD below is a diagram that was created at the very start, but after updates to the program the coding and the diagram itself has changed over time. This is because certain processes where decided to be changed from one to another. An example of this is, at the very start of the creation of the program there were no functions; the program itself was just a gigantic loop. But with the help of the FDD, the programming functions within the program made the process of implementing it very easy.