Question: I need the basic structure of this program What this Assignment Is About: Learn to read data from a file and partially fill a one-dimensional
I need the basic structure of this program
What this Assignment Is About:
Learn to read data from a file and partially fill a one-dimensional array.
Given an array, learn to compute the sum, average, find the minimum/maximun, etc
Learn to write functions by passing an array as input parameter
Learn to use parallel arrays
Coding Guidelines for All Labs/Assignments (You will be graded on this)
Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc).
Keep identifiers to a reasonably short length.
Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects).
Use tabs or spaces to indent code within blocks (code surrounded by braces). This includes classes, functions, and code associated with ifs, switches and loops. Be consistent with the number of spaces or tabs that you use to indent.
Use white space to make your program more readable.
Use comments properly before or after the ending brace of classes, functions, and blocks to identify to which block it belongs.
1. Assignment description
In this assignment, you will write a program that analyzes a company's employee bonus data. Employee data will be stored inside a file, each line of the file represents one employee's data in the following format:
lastName firstName bonusAmt
See below for a sample input file
Smith John 1525.25 Johnson Olivia 750.25 Bond James 6000.75 Duck Donald 450.75 Mouse Micky 5525.00 Poor Joe 1000.00 Rich Lawyer 3500.00
Assume there are maximum 100 employees in this company. First, your program should read in data from the file, you will then need to pick proper data types and declare array(s) that hold each employee's name and bonus data. Next, you will need to design at least the following four value-returning functions:
| Function | Function Description |
| double average(double anArray[], int size) | This function takes a double array and its size as input parameter, it computes and returns the average of the data inside the array. |
| int countHighBonus(double anArray[], double amt, int size | This function takes a double array, its size and a bonus amt as input parameter, it returns the number of array element which is greater or equals to amt. |
| int findMaxIndex(double anArray[], int size) | This function takes a double array and its size as input parameter, it computes and returns the largest array element's index. |
| int findMinIndex(double anArray[], int size) | This function takes a double array and its size as input parameter, it computes and returns the smallest array element's index. |
Note: The last two functions return the index of the array elements with the highest or lowest bonus amounts.
After above computation, your program should display the following bonus report on screen (by using main() or write another displayReport() function)
======== 2014 Company Bonus Report ======== There are 7 employees in the company. Bonus Average is: $2678.86 James Bond received the highest bonus which is: $6000.75 Donald Duck received the lowest bonus which is: $450.75
Next, your program should allow user to enter a bonus amount, it then output to show the number of employees who received a bonus amount which equals to or more than this amount.
Hint: You should consider using parallel array of string data type for name and double array for bonus amount, then using the min or max index to print out the employee's name who received the lowest or highest bonus accordingly.
Sample Run
Assume the following is file EmployeeInfo1.txt contents:
Smith John 1525.25 Johnson Olivia 750.25 Bond James 6000.75 Duck Donald 450.75 Mouse Micky 5525.00 Poor Joe 1000.00 Rich Lawyer 3500.00
User input is in bold. Below is the running result of Assignment7.cpp
Please enter the file's name: EmployeeInfo1.txt ======== 2014 Company Bonus Report ======== There are 7 employees in the company. Bonus Average is: $2678.86 James Bond received the highest bonus which is: $6000.75 Donald Duck received the lowest bonus which is: $450.75 Enter a bonus amount: 800.0 5 people received bonus more than $800.00
2. Misce. Programming Requirements
Your program must also meet the specifications stated as below:
All double value of the program's output need to be formatted with 2 decimal digits. See the sample run at the end of the specification. The exact spacing is not important, what is important is that the output looks good and the columns align.
Pick and use identifiers which are self-descriptive. One-letter variable names should not be used. As an example, if you were referring to the ticket price, the variable needed might be declared as double price; instead of double x;
As we stated before, make sure for each of the file, you put the following comment header block on top of the file:
//**************************************************************************
// FILE: Assignment7.cpp
// Name: your-name
// Student ID: your-ASU-10-digits-ID
// Description:
//***************************************************************************
3. Submission
1) Test your program by using the inputs from the following input test case, compare your program's output with our solution output, make sure they are same before you submit the source files. Read this short description on how to use test cases for your lab or assignments
2) For this assignment, you will need to submit TWO files:
Assignment7.cpp
EmployeeInfo.txt (right-click on the file, pick "Save Target As" to download)
at the following submission website:
https://courses.eas.asu.edu/cse100c/
login, then click on Assignment Submissions in the left frame. The dropdown box will start in HW1, make sure you change it by picking HW7 instead.
Click on the browse button and find where you saved your project, upload both Assignment7.cpp and EmployeeInfo.txt to the site and then click on the Submit button.
Your file will be submitted and a screen will show up displaying if your program compiled and what your output is when run on the two input test cases.
You should then check to make sure that the actual file submitted properly and is readable to the grader. To do so click on Grades in the frame on the left of the page and then click on the 0 underneath column HW7. You will again see that your program compiled and the program's output, but you should scroll down to the bottom of the screen and make sure your file is readable as well.
It's your responsibility to make sure that you submitted the correct file on server. After the deadline, we will not accept submissions through emails!
4. Grading Rubric (20 pts)
Student submits the relevant source code files Assignment7.cpp, whether the program compiles and/or runs correctly or not. [2 pts]
The average( ) function is designed correctly. [2 pts]
The countHighBonus( ) function is designed correctly. [2 pts]
The findMaxIndex( ) function is correctly written [2 pts]
The findMinIndex( ) function is correctly written [2 pts]
Inside the main( ), students correctly use loop to read in the input data and store them inside an array. [2 pts]
Inside the main() function, students correctly called above four functions. [2 pts]
The program student submitted compiles, runs, and produces the correct output for the two test cases [6 pts]
Input
The following files are the test cases that will be used as input for your program (Right-click and use "Save Target As"):
Test Case #1 Test Case #2
Output
The following files are the expected outputs of the corresponding input files from the previous section (Right-click and use "Save Target As"):
Test Case #1 Test Case #2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
