Rich Software Inc. has hired you for an internship position to create new payroll
software for their 5 employees. Your goal is to create a program that reads the data.txt
file with their 5 salaries. After that, the user can select from a 4 choice menu that
handles the user’s choices as descried in the details below. The program should display
the menu until the user selects the menu option quit.
Add the data.txt file inside your project
- Declare the number of employees as a const. This const is to be used as size of
your array. - Create the first for loop to read the data from the data file into an array.
- Once the salary data has been read into the array, display a menu with 4 choices
to the user as follows below. This needs to be setup as a do while and repeat the
program until the user selects the menu choice 4 (Quit).
Please select 1, 2, 3, or 4:
Search salary, Enter 1
Generate stats file, Enter 2
Print salaries, Enter 3Quit, Enter 4
Then set up a switch statement with these cases to handle the user’s selection. - If the user selects the menu choice 1, ask the user for a salary, then use a for
loop to search for the exact match inside your array and display result message
if the match is found : “Matching salary found” and if the match is not found
display: “The salary you entered is not found” - If the user selects the menu choice 2, use another for loop to find the highest and
lowest salary figures. Then generate a new text file called stats.txt, record the
highest and lowest salary figures and save that file. Then display a message to
the user: The stats.txt file has been generated. - If the user selects the menu choice 3, use another for loop to display all salaries
to the user. - If the user selects the menu choice 4, exit the program. Otherwise, display the
menu again.
All I have is this:
#include <iostream>
#include <iomanip>
const int employees=5;
int count;
int choice;
char average;
cout << "Please select 1, 2, 3, or 4:\n"
cin >> choice;
cout << "Search salary, Enter 1\n"
cout << "Generate stats file, Enter 2\n"
cout << "Print salaries, Enter 3\n";
cout << "Quit, Enter 4\n";
for (int i = 0; i < 5; i++)
file >> salary[i];
Need it in 15 mins, please help! Forgot that it was due right now, I am stuck and I might fail this assignment.