I have an assignment below that I am working on. I also have a skeleton of a program down below that I need help with.
How can I finish writing this program? What do I need to correct? What do I need to add and what exactly do I need to add to make this program compile and execute correctly?
You have been hired to keep track of monthly information at a local airport. Below are the specific requirements – you will be using an array of structs:
You will define a structure that can contain the following data for an entire month:
• 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. NOTE: in order to save time as you test your program, you should use a smaller array – perhaps 4 months. You may simply initialize the array of structures so that you don’t need to enter data every time you run your code for testing & debugging purposes. How you test your program is up to you but you don’t need to enter the data for 12 structures each time you test the code.
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 year, and the greatest and least number of planes that landed on any one day.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
using namespace std;
struct MthlyInfo {
int totNumLand;
int totNumDep;
int greNumLand;
int leaNumLand;
};
new MthlyInfo yearinfo[12];
int main()
{
int mthlyPlnLand;
int mthlyPlnDep;
int grtNumPlnLand;
int lowNumPlnLand;
for (index = 0; index < yearinfo[index]; index++) {
cout << "How many planes have landed this month? " << endl;
cin >> mthlyPlnLand[index];
cout << "How many planes have departed this month? " << endl;
cin >> mthlyPlnDep[index];
}
return 0;
}
| |