[Solved] ET580 Project

$25

File Name: ET580_Project.zip
File Size: 122.46 KB

SKU: [Solved] ET580 Project Category: Tag:
5/5 - (1 vote)

Makefile

Submit an edited makefile which runs the phase file you wish to have graded.

Windows

Select/Highlight all files in your project. Right click, Send To, Compressed (zipped) Folder.

OSX

Select/Highlight all files in your project. Right click, Compress X Items.

Blackboard

  1. Rename the zip file zip such as John_Smith.zip.
  2. Open the Project folder in Course Documents.
  3. Click Project Assignment
  4. Drag your named .zip file into the upload Click Submit.

REQUIRED FILES FOR SUBMISSION

makefile (edit to automatically run the Phase_#.cpp you choose)
MyArray.h (modified version of Template Homework, MyArray.cpp not required)

Airline.h

Airline.cpp

Airport.h

Airport.cpp

Flight.h

Flight.cpp

Passenger.h

Passenger.cpp

Person.hPilot.hPilot.cpp (abstract class, Person.cpp not required)
Phase_1.cpp (do not edit, used to test project skeleton)
Phase_2.cpp (do not edit, used to test default constructors and output)
Phase_3.cpp (do not edit, used to test accessors and mutators)
Phase_4.cpp (do not edit, used to test MyArray data members and related functions)
Phase_5.cpp (must edit, used to build a project interface)

DOWNLOADABLE FILES

makefile. (edit to automatically run the Phase_#.cpp you choose)

Phase_1.cpp (do not edit, used to test project skeleton)
Phase_2.cpp (do not edit, used to test default constructors and output)
Phase_3.cpp (do not edit, used to test accessors and mutators)
Phase_4.cpp (do not edit, used to test MyArray data members and related functions)
Phase_5.cpp (must edit, used to build a project interface)

CONSOLE/MAKEFILE COMMANDS

OSX Windows

make mingw32-make run the makefile
make clean mingw32-make clean run the clean portion of the makefile
clear cls clear screen
./prog prog.exe execute the program named prog.exe
rm del delete in the clean section of the makefile
cd cd change directory
ls dir view folder directory (files and folders)

CONCEPT: FORWARD DECLARATIONS

For this project Forward Declarations of classes are required since classes are co-dependent upon each other. A practical example of this co-dependency would be if a Doctor object contains a list of Patient objects, and each Patient object contains a list of Doctor objects. In this situation, do we declare the Doctor or the Patient first? The solution is to use Forward Declarations in each file as follows:

// Doctor.h file

#include Patient.h // include Patient.h

class Patient; // forward declaration of the Patient class class Doctor {

Patient *patient_list; // array of Patient objects

};

// end of Doctor.h file

// Patient.h file

#include Doctor.h // include Doctor.h class Doctor; // forward declaration of Doctor class class Patient {

Doctor *doctor_list; // array of Doctor objects

};

// end of Patient.h file

CONCEPT: AGGREGATIONS AND INHERITANCE

This project will associate classes via Aggregations and Inheritance.

Within the scope of this project class aggregations will not require the big three since each object must have independent lifetimes and each object should not be cloned. This includes the majority of class types including Airline, Airport, Flight, Person and Pilot. Practically speaking Flights would be a logical candidate for cloning, but this is not a requirement for this project.

Furthermore, some use of inheritance/polymorphism will be required with the Passenger and Pilot classes since they are both of type Person.

CLASS ASSOCIATIONS

This project implements part of a simple flight reservation system using a variety of classes associated via aggregation and inheritance.

The is a simple list of classes and their data member associations (aggregation or inheritance) with other classes. Keep these associations in mind when considering dependencies and function requirements. Airline

Airport

MyArray Flight* (arrivals)

MyArray Flight* (departures)

Person

MyArray Flight* (flights)

Passenger (inherits from Person)

Pilot (inherits from Person)

Flight

Airline

Airport (source)

Airport (destination)

Pilot

MyArray Person* (passengers)

PROJECT PHASES

This is the probably the most complex program you have attempted to develop thus far. For this reason, the project has been divided into five implementation phases. Five Phase_#.cpp files (1 to 5) have been provided to test your project at each phase of development.

Your project will run with only one Phase_#.cpp file at a time which is decided by editing your makefile.

Phase_1.cpp through Phase_4.cpp files must not be edited in your project submission to receive credit. Phase_5.cpp must be edited to match the client interface specifications of the fifth phase.

You should read this entire document (especially class specifications) before starting the project.

Watch the video to help you understand how to proceed and what is required.

Phase 1: Implement the project skeleton

  1. Make sure your Template Homework MyArray container compiles as is. If not fix it first.

Copy the template MyArray class code (nothing else) into a MyArray.h file.

  1. Create empty .h and .cpp files for all of the files listed above.
  2. Only add the following required code for each file (review the class descriptions): include statements
    1. header guards (#ifndef, def, #endif code)
    2. forward declarations if required
    3. Basic class code including:
      1. All data members except for MyArray objects
      2. Default constructor declarations in .h files, definitions in .cpp files (no other functions)
    4. Duplicate the downloaded makefile for easy copy/paste editing later on.
    5. It may help to remove any references to Flight in the makefile until you get all other files working.
    6. Repetitively compile and debug until the skeleton of the program is functioning.

Do not advance until Phase 1 compiles perfectly.

Phase 2: Constructors and Output

  1. Modify the makefile to run cpp instead of Phase_1.cpp.
  2. Comment out and uncomment parts of cpp as you work through this phase.
  3. Complete all constructor functions with exception to MyArray object content for these classes:

Airline, Airport, Person, Pilot, Passenger, Flight

  1. Complete getName accessor function declarations and definitions for the following classes:

Airline, Airport, Pilot, Passenger

  1. Complete the overloaded << operator functions for the following classes: Airport, Passenger, Pilot, Flight

Do not advance until Phase 2 compiles perfectly.

Phase 3: Accessors and Mutators

  1. Modify the makefile to run cpp instead of Phase_2.cpp.
  2. Add the remaining specified set and get (not add/remove) functions for the following classes:

Airline, Airport, Flight, Passenger, Person, Pilot

  1. For the moment avoid any code which requires add/remove functions for MyArray objects.

Do not advance until Phase 3 compiles perfectly.

Phase 4: MyArray Objects and Functions

  1. Modify the makefile to run cpp instead of Phase_3.cpp.
  2. Add MyArray objects as specified to the following classes:

Airport, Person, Flight

  1. Add addArrival, removeArrival, addDeparture, removeDeparture functions to class Airport.

Update the Flight multi-parameter constructor to work with these new functions.

  1. Add Pilot addFlight and removeFlight

Add Passenger addFlight and removeFlight functions.

Add Flight addPassenger and removePassenger functions

Add Flight getPassenger, listPassengers and getNumPassengers functions Note that all of these functions and similar and are dependent upon each other.

You need to update all of these functions progressively and simultaneously while testing for compiler errors.

  1. Add any remaining class functions (check all files and class specifications).

Do not advance until Phase 4 compiles perfectly.

Phase 5: Client Interface

The client interface is a program that uses all classes of your project to build a flight reservation system.

  1. Modify the makefile to run cpp instead of Phase_4.cpp.
  2. Modify cpp to create a flight reservation client interface.

See the Client Interface description at the end of this document (last two pages).

CLASS SPECIFICATIONS

Class Airline

Data member:

name (string): name of the airline

Functions:

  1. default constructor
  2. one parameter constructor
  3. name mutator
  4. name accessor

Class Airport

Data member:

name (string): name of the airport

symbol (string): 3 letter symbol, for example John F Kennedy is JFK arrivals (MyArray): MyArray of arriving flight object pointers departures (MyArray): MyArray of departing flight object pointers

Functions:

  1. default constructor
  2. two parameter constructor
  3. name mutator and accessor
  4. symbol mutator and accessor
  5. addArrival
  6. Call whenever a flight destination is set to this airport
  7. Check if a flight is in arrivals If so, add flight to arrivals
  8. addDeparture
  9. Call whenever a flight source is set to this airport
  10. Check if a flight is in departures If so, add flight to departures
  11. removeArrival
  12. Call whenever a flight destination is no longer this airport
  13. Check if a flight is in the arrivals If so, remove flight from arrivals
  14. removeDeparture
  15. Call whenever a flight source is no longer this airport
  16. Check if a flight is in departures If so, remove flight from departures
  17. closeAirport
  18. All flights in arrivals and departures should have source/destination set to nullptr (use flight functions) j. overloaded << operator
  19. Print name, symbol and list arrivals and departures, if no arrivals or departures print none.

Class Person

This is an abstract class which does not require a .cpp file, only a .h file.

Data member:

name (string): name of the airline

Functions:

  1. default constructor inline definition
  2. one parameter constructor inline definition
  3. name mutator pure virtual function (defined in derived classes)
  4. name accessor pure virtual function
  5. addFlight pure virtual function
  6. removeFlight pure virtual function

Class Pilot

This class is derived from class Person.

Data member:

flights (MyArray): MyArray of flight object pointers

Functions:

  1. default constructor
  2. one parameter constructor
  3. addFlight
  4. Check if a flight is in flights
  5. If not, add flight to flights
  6. Set flight pilot to this pilot (use flight functions)
  7. removeFlight
  8. Check if a flight is in flights
  9. If so, remove flight from flights
  10. Set flight pilot to nullptr (use flight functions)
  11. overloaded << operator
  12. Print name and list flights

Class Passenger

This class is derived from class Person.

Data member:

flights (MyArray): MyArray of flight object pointers

Functions:

  1. default constructor
  2. one parameter constructor
  3. addFlight
  4. Check if a flight is in flights
  5. If not, add flight to flights
  6. Add passenger to flight passengers (use flight functions)
  7. removeFlight
  8. Check if a flight is in flights
  9. If so, remove flight from flights
  10. Remove passenger from flight (use flight functions)
  11. cancelFlights
  12. Remove passenger from every flight in flights (use flight functions)
  13. overloaded << operator
  14. Print passenger name and list the flights

Class Flight

Data member:

number (int): the number of the flight airline (Airline): the flight airline source (Airport): the airport the flight will depart from destination (Airport): the airport the flight will arrive at pilot (Pilot): the pilot of the flight

passengers (MyArray): MyArray of Person object pointers

Functions:

  1. default constructor
  2. multi parameter constructor
  3. Initialize number, airline, source, destination and pilot
  4. Add this flight to the source airport departures (do this after Airport class is complete)
  5. Add this flight to the destination airport arrivals (do this after Airport class is complete) Add this flight to the pilot flights (do this after Pilot class is complete)
  6. getNumber return flight number
  7. getAirline return airline pointer
  8. getSource return source pointer
  9. getDestination return destination pointer
  10. getPilot
    1. If pilot is nullptr return No Pilot
    2. otherwise, return pilot name as string (use pilot functions)
  11. getPassenger
    1. given an index, return a Person object reference to a passenger in passengers
  12. setAirline Airline object as parameter
  13. setSource Airport object as parameter
  14. setDestination Airport object as parameter
  15. setPilot
  16. Pilot object as parameter
  17. If replacing a pilot, remove this flight from old pilot flights Set pilot to new pilot and add flight to new pilot flights
  18. nullPilot set pilot to nullptr
  19. nullSource set source to nullptr
  20. nullDestination set destination to nullptr
  21. addPassenger
  22. Accept a Person object by parameter.
  23. Check if passenger is in passengers.
  24. If not, add passenger to passengers and add flight to passenger flights
  25. removePassenger
  26. Accept a Person object by parameter.
  27. Check if passenger is in passengers.
  28. If so, remove passenger from passengers and remove flight from passenger flights
  29. listPassengers print a list of the passengers
  30. getNumPassengers return the number of passengers
  31. cancel
  32. Remove flight from source airport departures, set source to nullptr
  33. Remove flight from destination airport arrivals, set destination to nullptr
  34. Remove flight from pilot flights, set pilot to nullptr
  35. Remove flight from each passenger flights in passengers
  36. overloaded << operator
  37. Print number, airline, source, destination, pilot and list passengers.

CLIENT INTERFACE

Modify the Phase_5.cpp file to implement a flight reservation client interface as specified below. The provided file implements a few global containers and a read function with some data to get you started

Watch the end of project video for a walk through of the client interface.

EXPECTATIONS/ CONCERNS

The description for the client interface is somewhat vague to provide some flexibility in implementation.

When modifying objects it is extremely important to update all associated objects. For example if you delete a Flight you have to update associated MyArray objects such as source object departures, destination object arrivals, pilot object flights and passenger object flights. Always consider how all associations will be impacted when modifying data.

Above all, it is important that the interface you code is easy to read, easy to understand and bug free. It is significantly better to code less with no bugs then to code more with tons of bugs. CONTAINERS (provided In original Phase_5.cpp file)

AirlinesAirportsPassengersPilotsFlights MENUS MAIN MENU:
1 Airports (opens Airports submenu)
2 Flights (opens Flights submenu)
3 Passengers (opens Passengers submenu)
4 End program AIRPORTS SUBMENU (end the program)
1 List Airports (list Airports by index)
2 Create Airport (create a new Airport name and symbol)
3 Delete Airport (list Airports, select by index to delete)
4 Main Menu FLIGHTS SUBMENU (return to Main Menu)
1 List Flights (list Flights by index)
2 Add Flight (create a new Flight, select all data members by index)
3 Delete Flight (list Flights, select by index to delete)
4 Select Flight (list Flights and select by index to open Flight Submenu)
5 Main Menu (return to Main Menu)
FLIGHT SUBMENU
1 Change Pilot (list pilots, select by index to modify pilot)
2 Change Departure Airport (list Airports, select by index to modify source airport)
3 Change Arrival Airport (list Airports, select by index to modify destination airport)
4 Add Passenger (list Passengers, select by index to add Passenger)
5 Remove Passenger (list Passengers, remove by index to remove Passenger)
6 Flights Menu PASSENGER SUBMENU (return to Flights Submenu)
1 List Passengers (lists all Passengers in database)
2 Create Passenger (create a new Passenger and add it to the Passengers container)
3 Delete Passenger (lists Passengers, select by index to delete)
4 Main Menu (return to Main Menu)

FUNCTIONS

These are a number of recommended functions you should implement to support menu actions in the Phase_5.cpp file. The purpose of these functions should be relatively obvious if you examine the menus. Many of these functions access the global containers to provide a list of options for the user to select from.

listAirlines listAirports listFlights selectPilot selectSourceAirport

selectDestinationAirport addPassenger removePassenger

changeFlight (can use this to run the Flight Submenu or code it in Main) createAirport deleteAirport createPassenger

deletePassenger

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] ET580 Project[Solved] ET580 Project
$25