Project 2 - Implement the Code for controlling the retraction and extension of Airplane’s landing gear
#include <iostream>
using namespace std;
string lights,lever;
void setLightsYellow(){
lights = "Yellow";
}
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() != "Yellow" )
return "Can't take off because lights are not Yellow\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()
{
setLightsYellow();
cout<<takeOff();
setLightsGreen();
cout<<landing();
return 0;
}