Project 5 - Airplanes



Due: On or before 11:59:59PM Friday 3 June, via handin on vogon.
Updates:
-1. After you run
make coverage

you can see which lines of your code are being tested, and which are not.

Open airplane.c.gcov in an editor (e.g. vim). Lines with ######'s on the left are lines that were not executed by your tests. Try to write tests that will execute all of your code in airplane.c.

It is okay if you just call printPassenger and printSeatMap and check them manually in your tests.

It is also okay if you don't get 100%, but I do expect you to get at least over 90%. I will give a few bonus points if you achieve 100%.

More info on gcov is here.

0. You can get the user interface code from ~djanzen/www/courses/101S11/projects/proj5/airplanedriver.o

1. I will extend the due date by one day to Friday night at 11:59:59. Woohoo!

2. Your job is to write airplane.c and airplanetests.c. Both of these files should #include "airplane.h".

3. You should not modify airplane.h in any way.

4. You compile your files with the following command: make test

5. For all of the functions that have row and col as parameters, row and col should be indexes into the array seatMap. In other words, the first row is 0, not 1. My code (airplanedriver.c) will translate this (i.e. add one) for the user.

6. Even though fare and weight are int's some functions return double's. Keep it that way. I know, it was a mistake on my part, but I don't want to change it.

7. Your two functions that print output (printSeatMap and printPassenger) should match the formats on the web page and the .h file exactly. I placed files at http://users.csc.calpoly.edu/~djanzen/courses/101S11/projects/proj5/seatmap.txt and http://users.csc.calpoly.edu/~djanzen/courses/101S11/projects/proj5/passenger.txt that you can diff against if you like.

8. I modified the makefile (http://users.csc.calpoly.edu/~djanzen/courses/101S11/projects/proj5/makefile). Using this new makefile, you can check to see if your tests execute all of your functions in airplane.c. To run it, type make coverage

Near the bottom you will see a line like this:
Lines executed:83.33% of 96

You want it to say 100%.

Specification:

You are to write a program that allows a user to enter, manipulate, and print passenger information on airplanes. At a minimum, your program should allow the user to enter passenger information including first name, last name, phone number, fare (how much they paid), and approximate weight. The data should be written to a file named "flight.txt". When the program starts, it should read the data from this file, and allow modifications to the data (e.g. add a passenger, remove a passenger). You may rewrite the file each time. You may assume that the file always exists, although it would be empty the first time the program is run. The user should be able to assign passengers to seats and remove passengers from seats. The user should be able to print a listing of which seats are available/taken. The user should be able to print a list of all passengers on a plane. The user should be able to print the total revenue for the flight (sum of all passenger fares), and see the total weight of passengers on the plane as well as the distribution (how much weight in the front half of the plane and how much in the back half). You may assume that the plane has 26 rows of six seats each. A sample list of seats available/taken might look like this (X means taken, A means available):
    A B C D E F
1  X A X A A A
2  X A A X X X
3  A X X X A X
4  X A X A A A
5  X A X A A A
6  A X X X A X
7  X A A X X X
8  X A X A A A
9  X A A X X X
10 X A X A A A
11 A X X X A X
12 A A A X A A
13 A A A X A A
14 A A A X A A
15 A A X A A A
16 A A A A A A
17 A A A A A A
18 X A X A A A
19 A A A A A A
20 A A A A A A
21 A A A A A A
22 A A A A A A
23 A A A A A A
24 A A A A A A
25 A A A A A A
26 A A A A A A

Sample seatmap.txt and passenger.txt files are provided to help you get the formatting correct. The rest of the user interface will be detailed soon. The file format is up to you.

Structs, Function Decomposition and Automated Unit Tests

Your program must implement all of the functions detailed in airplane.h. You must write tests for all of the "Model" functions using the checkit_* functions as appropriate. Write these tests in a separate file named "airplanetests.c". Examples to get you started are given in airplanetests.c. This makefile is given to help you as well.

Code Style

Be sure to follow the course Code Style, and don't forget to run

indent -kr -nut airplanetests.c
and
indent -kr -nut airplane.c
on your program before handing it in.

Collaboration

NO collaboration is allowed on this assignment. Everyone must do their own individual work.

Program Turnin Procedure

You submit two program files named airplane.c and airplanetests.c. Use the vogon handin command:

handin djanzen 101_prog5 airplane.c airplanetests.c
Complete this survey.