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

  1. Declare the number of employees as a const. This const is to be used as size of
    your array.
  2. Create the first for loop to read the data from the data file into an array.
  3. 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.
  4. 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”
  5. 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.
  6. If the user selects the menu choice 3, use another for loop to display all salaries
    to the user.
  7. 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.

4 Years
Discussion Span
Last Post by deceptikon

15 mins. ROFL...

Nobody here is going to do your homework for you buddy. Tell us exactly what you are stuck with and someone might be able to point you in the right direction.

Edited by happygeek


Need it in 15 mins

Yeah...15 minutes would be really pushing it even for an expert who knows exactly what to write and doesn't require any debugging.

I'm happy to offer advice to help you learn when you have more time, but for this particular project, you're SOL.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.