Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2: Aircraft Maintenance System The regular maintenance of aircraft engines is critical to ensure the high level of safety of air travel. Maintenance activities

Part 2: Aircraft Maintenance System

The regular maintenance of aircraft engines is critical to ensure the high level of safety of air travel. Maintenance activities are scheduled for each engine of an aircraft after specific periods of use, which depend on the aircraft and engine model. In this assignment, you are asked to write a program that determines the maintenance schedule of aircraft engines. The program must be able to process different types of aircrafts (having different numbers of engines), requiring maintenance at different intervals. In this assignment, we will only consider two types of aircraft: Airbus A380 (four engines, requiring maintenance every 750 hours) and Boeing 737 (two engines, requiring maintenance every 500 hours).

Description

The input of the program is read from standard input. Each input line consists of a description of an aircraft, including the model (encoded as one character), the aircraft name (or tail code), and the number of hours recorded since the last maintenance check for each of its engines. The number of hours of use may differ among the engines of a given aircraft due to the fact that not all engines are subjected to maintenance at the same time.

Assignment

Aircrafts are represented as instances of the classes A380 and B737 that are derived from a base class Aircraft. The main program maintenance.cpp is provided, together with the header file Aircraft.h . Another program testAircraft.cpp is provided that tests the functionality of the Aircraft derived classes. You should not modify these files. You will implement the base class Aircraft, and the derived classes A380 and B737 in the file Aircraft.cpp . You will create a Makefile that includes a target all, which builds the executables maintenance and testAircraft. The maintenance program reads a list of aircraft descriptions from standard input and prints a description of the aircraft and its maintenance schedule. See the example input files and corresponding output files for details. Note that if an engines maintenance is past due, a special output message is printed instead of a time. If an unknown aircraft code is used, the program prints an error message and exits (see example files).

Example: the input line:

A VH-OQF 630 550 470 690 

describes an Airbus A380 named VH-OQF whose four engines have 630, 550, 470 and 690 hours of use since their last maintenance. Given this input, the maintenance program will print the following output:

Aircraft: VH-OQF type: Airbus A380 has 4 engines engine 1: 630 hours engine 2: 550 hours engine 3: 470 hours 
engine 4: 690 hours Maintenance schedule for VH-OQF engine 1: maintenance due in 120 hours engine 2: maintenance due in 200 hours engine 3: maintenance due in 280 hours engine 4: maintenance due in 60 hours 

If the input contains multiple lines, the program should process them sequentially until the end of file is reached in input.

Specification of the Aircraft classes

The Aircraft base class is an abstract class from which the classes A380 and B737 are derived. The base constructor takes two arguments: the number of engines and the aircraft name. In addition, the following member functions must be defined:

virtual const std::string type(void) const A pure virtual function returning a string (A380 or B737).

virtual const int maxHours(void) const 

A pure virtual function returning the maximum duration of use of an engine before maintenance is due.

const std::string name(void) const 

A member function returning the name of the aircraft.

int numEngines(void) const 

A member function returning the number of engines of the aircraft.

void setHours(int i, int h) A member function used to set the current number of hours of use for engine i .

void print(void) const 

A member function that prints the description of the aircraft on standard output (see first part of the above example).

void printSchedule(void) const 

A member function that prints the maintenance schedule of the aircraft on standard output (see above example).

static Aircraft* makeAircraft(char ch, std::string name_str) A static factory function that creates an Aircraft object of the appropriate type (determined by the character ch) and returns a pointer to it. If ch is A, an A380 must be created. If ch is B, a B737 must be created.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions