what I have done so far is
#include <iostream>
#include "conio.h"
#include <string>
#include <string.h>
using namespace std;
int main (){
cout<<"1- Add new employee"<< endl;
cout<<"2- Update a department sales"<< endl;
cout<<"3- Show the sum of sales for a department in a month"<< endl;
cout<<"4- Show the average of sales for all three department in a week" << endl;
cout<<"5- Print the departments' information" << endl;
cout<<"6- Exit" << endl;
int i;
cout<< "Please enter the option number:" ;
cin>> i;
switch (i){
case 1:
for (int x=0;x<100;x++)// I am a bit stuck here
{
char employeeNames[100];//= {"Ahmad","Nasser", "khaled","Fahad"} ;
int departments [100]; //= {1,2,3,1};
cout<<" Enter the Name of the Employee:";
cin>> employeeNames[x];
cout<<" Enter the Department number:";
cin>> departments[x];
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
}
return 0;
} |
the requirements of the system are
Consider a company system which has a menu offers the following options:
1. Add new employee.
2. Update a department sales.
3. Show the sum of sales for a department in a month
4. Show the average of sales for all three departments in a week
5. Print the departments' information.
6. Exit.
a) If option 1 is chosen, the main function passes one-dimensional array named employeeNames and one-dimensional arrays named departments to a function ADD. This function prompts the user for a new employee's information (name, department) and add them to these two arrays:
a. eployeeNames array: is a one-dimensional array with one columns which stores the name and a maximum of 100 rows (employee) where each row stores a single employee.
b. department array: is a one-dimensional array a maximum of 100 employee which stores the employee's department.
The function will return TRUE if the employee is added successfully, FALSE otherwise , then the main will print the new arrays.
b) If option 2 is chosen, the main function prompts the user to enter the department number (DN) and the week (W)to be updated. Then it passes DN , W and ONE two-dimensional array named sales to a function UPDATE. This function will search for the department and the week, prompt the user for a new sale and then updates Department's information.
The function will return TRUE if the department is updated successfully, FALSE otherwise .
c) If option 3 is chosen, the program should ask the user to specify which department he's interested in by displaying the following message:
Choose a department to compute its sales per a month: (Press 1 for Dep 1, Press 2 for Dep 2, Press 3 for Dep 3)
d) If option 4 is chosen, the program should ask the user to specify which week he's interested in computing its average by displaying the following message:
Choose a week compute the average of sales of all 3 departments in: (Press 1 for week 1, Press 2 for week 2, Press 3 for week 3, Press 4 for week 4)
e) If option 5 is chosen, the main function passes the sales array to a function PRINT. This function prints all the information for each department in the company. (BONOUS)
f) If option 6 is chosen, the main function stops immediately.