Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear
AIM:
To control the retraction and extension of Airplane’s landing gear can be implemented using Finite State Machine (FSM). FSM is the most efficient algorithm which is mathematical model of computation.
CODE:
#include
using namespace std;
string lights,lever;
void setLightsRed(){
lights = "Red";
}
void setLightsGreen(){
lights= "Green";
}
void setLightsOff(){
lights = "Off";
}
string getLights(){
return lights;
}
void setLeverUp(){
lever = "Up";
}
void setLeverDown(){
lever = "Down";
}
string getLever(){
return lever;
}
string takeOff()
{
if(getLights() != "Red" )
return "Can't take off because lights are not red\n";
setLeverUp();
setLightsOff();
return "Take Off Success\n";
}
string landing()
{
if(getLights() != "Green" )
return "Can't land because lights are not Green\n";
setLeverDown();
return "Landing Success\n";
}
int main() return 0; OR Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear Overview of the Project: In this project, a Finite State Machine is used to manage the retraction and extension of an airplane's landing gear (FSM). The most efficient algorithm is the FSM, which is a mathematical processing model. Actually an airplane has 3 gears for landing: Nose gear, Left gear, Right gear. There is an electrically powered hydraulic pump that applies pressure to the gears to bring it down or pull it up. There is a limit switch on each leg of the gear. One extra squat switch is installed in the nose gear to assess whether the plane is on the ground or not. Goals: Valve's direction can be controlled. Controlling the retraction and extension of the landing gear on an aeroplane. Source File: Header File:
{
setLightsRed();
cout<
cout<
}






