Write a program that uses a structure to store the following

Write a program that uses a structure to store the following information for a particular month at the local airport: Total number of planes that landed Total number of planes that departed Greatest number of planes that landed in a given day that month Least number of planes that landed in a given day that month The program should have an array of twelve structures to hold travel information for the entire year. The program should prompt the user to enter data for each month. Once all data is entered, the program should calculate and output the average monthly number of landing planes, the average monthly number of departing planes, the total number of landing and departing planes for the greatest and least number of planes that landed on any one day (and which month it occurred in).

Solution

struct planes

{ int total_landed;

int total_departed;

int greatest_number;

int least_number;

void average_landedcalculate()

{ int sum=0;

int average;

sum= sum+ total_landed;

average=sum/31;

cout<<\"average number planed landed\"<<average;

}

void average_departedcalculate()

{ int sum1=0;

int averaged;

sum1=sum1+ total_departed;

averaged=sum1/31;

cout<<\" the average planes departed\"<<averaged;

}

void calculate_total_in_year(int p,int q)

{ int total;

int totalsum=0;

totalsum+=total_landed+total_departed;

total=totalsum*12;

cout<<\"total number of planes in a year\"<<total;

}

};

void main()

{planes p1;

p1.total_landed=10;

p1.total_departed=12;

p1.average_landedcalculate();      // calculates average number of planes landed

p1.average_departedcalculate();// calculate average number of departed planes

p1.calculate_total_in_year();

}

 Write a program that uses a structure to store the following information for a particular month at the local airport: Total number of planes that landed Total
 Write a program that uses a structure to store the following information for a particular month at the local airport: Total number of planes that landed Total

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site