Challenge

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

# include <iostream>

using name spaces std;

string lights ,lever;

void set lights red () {

lights="red";

}

void set lights green () {

lights="green";

}

void set lights off (){

lights="off";

}

string get lights () {

lever ="up";

}

void set lever down () {

lever="down";

}

string get lever () {

return lever;

}

string takeoff ()

{

if (get lights ()|="red")

return "can't takeoff because lights are not red \n";

set lever up ();

set lightsoff ();

return "take off success \n";

}

string landing ()

{

if (get lights ()|="green")

return "can't land because lights are not green \n";

set lever down ();

return "landing success \n";

}

int main ()

{

set lights are red ();

cout <<take off ();

set light green ();

cout <<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.