Question: Generating Random Data Program! Please HELP! Problem description: A large company that sells high end furniture needs a program to help calculate their year end

Generating Random Data Program!

Please HELP!

Problem description:

A large company that sells high end furniture needs a program to help calculate their year end bonuses. For each of their 5000 employees, a percentage of their total sales amount minus the minimum total sales amount (taken from the employee with the lowest number of furniture sales) is multiplied by a percentage of their salary. This is their year end bonus, and employees count on this to be calculated accurately, since it can easily double their salary if they have a high sale volume.

Basically we need a prorgam the helps calculate bonuses fro employees based on their sales.

Part A:

Write a C++ program to generate the data file data.txt. Each line in this file represents an employee record, with each element separated by a comma which includes the: empID, firstname, lastname, storeID, salary, daysWorked As shown below for one employee:

100002, ozyomoimmtplme, tpvcrdfrowjnfur, 3549, 44442, 225,

The record above is just an example of one employee, remember there are 5000 employees(text file with 5000 lines). The text file should be sorted with the lowest empID first. Use an array of struct for the creation of the employees. Please note that the empID is a unique 6 digit number. You should use a random number generator to generate a unique ID for each employee. This should be accomplished within a stand alone function called genID() which also checks to make sure the ID is unique within the array of 5000 employees. The fact that this function accesses the entire array is part of why it is a standalone function and not a member function of the struct employee. For each employee you must randomly generate:

? A unique empID of 6 digits.

? A first name and a last name, (not unique) of random length between 8 and 16 characters, made up of random chars. This can be stored in separate variables or within its own struct

? A store ID (not unique) of 4 digits.

? A salary between 20,000 and 100,000(inclusive).

? Days Worked, 0-21 (inclusive) days for each month, for 12 months out of the year. The sum of days worked for all months will be stored in the file.

? Sales total for each day worked in a month are added to the monthly Sales Total. Monthly totals are separated by spaces o This can be stored in a single string o Sales should be higher for employees with higher salaries:

? Salaries<60000 , daily sales should be from 1000-15000 a day(for each day worked)

? Salaries>60000, daily sales should be from 3000-20000 a day(for each day worked)

o A line of output, including Monthly Sales Totals, should look like this: 100001, wtfxltnqbkviye, zhajstwyxcaptn, 9572, 52173, 123, 25908 0 92106 77831 41707 109114 26283 5399 149521 139501 108583 57303

All on one line in a text file. The total sales for each of the 12 months should be separated by a space, while the other items in the row should be separated by commas.

Other Functions for Part A:

? A Boolean member function which compares the empID of this instance of employee with another instance of employee passed as a parameter. Returns true if this.empID > another.empID .

? A print member function which prints the contents of this instance of employee in the format given above to an outstream.

? A standalone function which sorts the array by ID, using the member comparison function. Places the lowest ID number at the top of the Array (should be printed first in the file)

? A standalone function which prints out the employee array to file, calling the employee.print() function for each array member.

The resulting text file should contain 5000 employees, each on its own line, and all of their data. The employees should be sorted with lowest ID at the top of the file. ALL DATA SHOULD BE RANDOMLY GENERATED. Be sure that srand() is only being called once, so that the random number sequence doesnt restart over and over.

The data is read in by data.txt that contain 5000 lines so I'm not going to include the entire file but here are a couple lines from it:

data.txt

100001, wtfxltnqbkviye, zhajstwyxcaptn, 9572, 52173, 123, 25908 0 92106 77831 41707 109114 26283 5399 149521 139501 108583 57303 100002, xlefeqyr, dgiwxyibjqxrqu, 5465, 50621, 105, 29921 41402 131514 173208 128304 40607 80741 0 30520 26417 93091 0 100004, ijzzddjspfa, ywkcuuqpbi, 6256, 35827, 124, 29703 70826 30434 112621 5381 0 163068 122791 111850 30618 165097 52716 100007, ytgywofcwbzvb, plvthhbdge, 8284, 37960, 155, 161109 108927 85461 115598 141368 104623 101459 140496 27236 86811 15277 32991 100027, gmhjwukwijxda, drxufbbhf, 9257, 41563, 132, 35450 92446 65111 121296 73819 17461 169714 24057 113464 32785 138344 76547 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!