Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that uses a structure to store the following information for a p

ID: 3773896 • Letter: W

Question

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

Explanation / Answer

#include <stdio.h>
struct airport {
    int landed;
    int departed;
    int greatest;
    int least;
  
};
int main()
{
   struct airport A[12];
   int i, total_landed = 0, total_departed = 0,great,low;
   float avg_landed, avg_departed;
   printf("Enter airport deatails ");
   for(i=1;i<=12;i++)
   {
       scanf("%d%d%d%d", &A[i].landed,&A[i].departed,&A[i].greatest,&A[i].least);
   }
   for(i=1;i<=12;i++)
   {
        total_landed = total_landed + A[i].landed;
        total_departed = total_departed + A[i].departed;
   }
   avg_landed = total_landed/12;
   avg_departed = total_departed/12;

    great = A[1].landed;
   low   = A[1].landed;
   for(i=1; i<=12; i++)
   {
       if(great < A[i].landed)
           great = A[i].landed;
       if(low > A[i].landed)
           low = A[i].landed;
   }
  
    printf("Total Landed Planes   : %d ", total_landed);
    printf("Total Departed Planes : %d ", total_departed);
    printf("Total Average Landed Planes   : %d ", avg_landed);
    printf("Total Average Departed Planes : %d ", avg_departed);
    printf("Total greates landed Planes   : %d ", great);
    printf("Total Least Landed Planes     : %d ", low);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote