Challenge

Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear

Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear

AIM: to control the retraction an extraction of airplanes landng gear can be implemented using finite state machine(FSM). FSM is the most efficient algorithym which is mathamatical model computation.

#include<.stdio.h>

#include <iostream>
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 setleveldown()
{
lever = "down";
}
string getlever()
{
return lever;
}
string takeoff()
{
if(getlights() ! = "red")
return "can't land because lights are not redn";
setleverup();
setleveroff();
return "take off successn";
}
string landing()
{

if(getlights() ! = "green")
return "can't land because lights are not greenn";
setleverup();
setleveroff();
return "landing successn";
}
int main()
{
setlightsred();
count<<takeoff();
setlightsgreen();
count<<landing();
return 0;
}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.