Your program will have a class called FlightController that is going to be derived from two base classes which are called LaunchController and LandingController. The FlightController class inherits all accessible data fields and methods from the LandingController and LaunchController classes.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question

Your program will have a class called FlightController that is going to be derived from two base classes which are called LaunchController and LandingController. The FlightController class inherits all accessible data fields and methods from the LandingController and LaunchController classes.

 

_________________________________________________________________

//i need more explanations :(

#include<iostream>
#include<algorithm>
using namespace std;
class flight{
protected:
string flight_name;
int launch_hour;
int launch_min;
int land_hour;
int land_min;
int duration;
string state;
public:
flight(string state="Idle"){
this->state=state;
}
void check();
int get_launch_hour();
int get_launch_min();
int get_land_hour();
int get_land_min();
int get_duration();
string get_state();
void set_state(string);
void set_duration(int);
void calculate_landing();
};
int flight::get_duration(){
return duration;
}
void flight::set_duration(int a){
duration=a;
}
int flight::get_launch_hour(){
return launch_hour;
}
int flight::get_launch_min(){
return launch_min;
}
int flight::get_land_hour(){
return land_hour;
}
int flight::get_land_min(){
return land_min;
}
string flight::get_state(){
return state;
}
void flight::set_state(string s){
state=s;
}
void flight::calculate_landing(){
int time;
launch_hour*=60;
time=duration+launch_hour+launch_min;//time=610
land_hour=time/60;//land hour=10
land_min=time-land_hour*60;
launch_hour/=60;
}
void flight::check(){
}
class flight_schedule:public flight{

};
class flight_controller:public flight_schedule{
};
class launch_controller:public flight_controller{
protected:
int launch_hour;
int launch_min;
int launch_hour1;
int launch_min1;
public:
};
class landing_controller:public flight_controller{
protected:
int land_hour;
int land_min;
int land_hour1;
int land_min1;
public:
};
int main(){
flight_schedule *ft[3]={new flight_schedule,new flight_schedule,new flight_schedule};
for( int i=0 ; i<3; i++ )
{
cout<<"Enter the name of the flight: ";
ft[i].get_state();
cout<<"Enter the departure time of the plane:";
ft[i].get_launch_hour();
ft[i].get_launch_min();
cout<<"Enter the duration of the flight in minutes:";
ft[i].get_duration();
cout<<endl<<endl;
}
}

cmpe225_hw1 (1).pdf
5 / 6
159%
+
Tam ekrandan çıkmak için F11 tuşuna basın
Example Outputs
Output 1
Enter the name of the flight: A
Enter the departure time of the plane: 10 10
Enter the duration of the flight in minutes: 70
Enter the name of the flight: B
Enter the departure time of the plane: 10 20
Enter the duration of the flight in minutes: 15
Enter the name of the flight: C
Enter the departure time of the plane: 11 25
Enter the duration of the flight in minutes: 90
Launch Order
A Launch at 10 : 10 Flight State: IDLE
B Launch at 10 : 20
C Launch at 11 : 25 Flight State: IDLE
Flight State: IDLE
Landing Order
B Landing at 10 : 35Flight State: IDLE
A Landing at 11 : 20Flight State: IDLE
C Landing at 12 : 55Flight State: IDLE
Process exited after 24.81 seconds with return value e
Press any key to continue
Transcribed Image Text:cmpe225_hw1 (1).pdf 5 / 6 159% + Tam ekrandan çıkmak için F11 tuşuna basın Example Outputs Output 1 Enter the name of the flight: A Enter the departure time of the plane: 10 10 Enter the duration of the flight in minutes: 70 Enter the name of the flight: B Enter the departure time of the plane: 10 20 Enter the duration of the flight in minutes: 15 Enter the name of the flight: C Enter the departure time of the plane: 11 25 Enter the duration of the flight in minutes: 90 Launch Order A Launch at 10 : 10 Flight State: IDLE B Launch at 10 : 20 C Launch at 11 : 25 Flight State: IDLE Flight State: IDLE Landing Order B Landing at 10 : 35Flight State: IDLE A Landing at 11 : 20Flight State: IDLE C Landing at 12 : 55Flight State: IDLE Process exited after 24.81 seconds with return value e Press any key to continue
cmpe225_hw1 (1).pdf
2 / 6
135%
+
Assignment
Write a program that will track certain information about the flights of aircrafts. You
will create your program by referencing the structure given in the diagram (1). Class
definitions, access specifiers, data members and member functions in your program must be
coherent with the diagram. Certain essential variables for operations such as loops, flag
values, counts etc. are not given in the diagram therefore you can define them as your own
extra variables in the program.
LaunchController
LandingController
-launchHour1: int
- launchHour2: int
- launchMin1: int
landHour1: int
- landHour2: int
- landMin1: int
- launchMin2: int
landMin2: int
+ launchSchedule(FlightSchedule" ): void
+ landingSchedule(FlightSchedule" ): void
Extends
Extends
FlightController
# flight_schedule: FlightSchedule
+ FlightController()
+ flights: FlightSchedule"
Flight
|- flightName: string
|- launchHour: int
- launchMin: int
-landHour: int
-landMin: int
FlightSchedule
duration: int
- flights[]: Flight
- state: string
+ method(type): type
+ getlaunchHour(): int
+ getLaunchMin(): int
+ getlandHour(): int
+ getLandMin(): int
+ getState(): string
+ setState(string): void
+ calculatelanding(): void
Transcribed Image Text:cmpe225_hw1 (1).pdf 2 / 6 135% + Assignment Write a program that will track certain information about the flights of aircrafts. You will create your program by referencing the structure given in the diagram (1). Class definitions, access specifiers, data members and member functions in your program must be coherent with the diagram. Certain essential variables for operations such as loops, flag values, counts etc. are not given in the diagram therefore you can define them as your own extra variables in the program. LaunchController LandingController -launchHour1: int - launchHour2: int - launchMin1: int landHour1: int - landHour2: int - landMin1: int - launchMin2: int landMin2: int + launchSchedule(FlightSchedule" ): void + landingSchedule(FlightSchedule" ): void Extends Extends FlightController # flight_schedule: FlightSchedule + FlightController() + flights: FlightSchedule" Flight |- flightName: string |- launchHour: int - launchMin: int -landHour: int -landMin: int FlightSchedule duration: int - flights[]: Flight - state: string + method(type): type + getlaunchHour(): int + getLaunchMin(): int + getlandHour(): int + getLandMin(): int + getState(): string + setState(string): void + calculatelanding(): void
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning