Challenge

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

#include<stdio.h>
#include<string.h>
/*varibles*/
int take_f_state=0;
int lan_f_state=0;
int f_hight=250;
int f_wheel_=1;
char name_1[]="take_off";
char name-2[]="landing";


/*function prototype*/
void take_ _ off();
void landing();

int main();
{
char pro[10];//local variable
printf("enter the process;");
scanf("%s",pro);//get input from user
if((strcmp(pro,name_1))==0)//check the condition
{
while(1)//rut until the process is end
{
take_ _ off();
if(take_f_state==5)//check the condition
{
take_f_state=0;
break;
}
}
}

if((strcmp(pro,nmae_2))==0//check the condition
{
while(1)//rut until the process is end 
{
landing();
if(lan_f_state==5)//check the condtion 
{
lan_f_state=0;
break;
}
}
}

void landing ()//function defination
{
switch(lan_f_state)
{
case 0;
printf("extended process statrt.,n");//first state 
lan_f_state=1;
break;
case 1;
if(f_hight>200)//check the hight 
{
printf("proper hight is reached n");
lan_f_state=2;
}
else//else wait for gight is reached
{
printf("wating for proper hight is reached 
{
printf("wating for proper hight reach..");
}
break;
case 3;
printf("lever is activatedn");//activated the lever
printf("hydralic pump value is changedn*);//change the value
lan_f_stae=4;
break;
case 4;
if(f_wheel==1)//check the wheel position
{
printf("wheel is properly get outn");
printf("extended process is complete ");
lan_f_state=5;
}
else//wait for wheel get in
{
printf("wait for wheel get out..");
}
break;
case 2;

printf("door openn");//close the door
lan_f_state=3;
break;
}
}

void take_ _off()//function defination
{
switch(take_f_state)
{
case 0;
printf("retracted process start..n");//firsty state
take_f_state=1;
break;
case 1;
if(f_hight>200)//check tghe hight
{
printf("proper hight id reached n");
take_f_dtate=2;
}
else//wait for hight is reached
{
printf("wating for propepr hight to reach..");
}
break;
case 2;
printf("lever is activatedn");//activated the lever 
printf("hydralic pump value is chngedn");//change the value
take_f_state=3;
break;

case 3;
if(f_wgeel==1)//check rhe wheel position
{
printf("wheel is properly get inn");
take_f_state=4;
}
else//wait for wheel get in
{
printf("wait for wheel get in..,");
}
break;
case 4;
printf("door closedn");//close the door
printf("retracted process is completed");//process is complete
take_f_state=5;
break;
}
}



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.