Computers and Technology

In C++ please. A company has sales reps that sell two different product lines. The sales amounts for each product are recorded. A commission is paid based on the total sales. The commission is determined as follows:

Total sales Commission

less than $4000 5% of sales

$4000 to less than $8000 7% of sales

$8000 or more 10% of sales

Data for sales reps is stored in a file salesdata. txt. Each line of the file is in this format:

Salesrep name#sales1 sales2

Create a struct to represent a SalesRep with

-Name

-Product1 sales

-Product 2 sales

-Total sales

-Commission

Create an array of type SalesRep in main that can hold up to 20 reps.

Your program will prompt for the name of the file and validate that it exists. Read the data from the file and populate the array. You will need to count the actual number of sales reps in the file. Make sure your code tests that the array is not overfilled.

Create and generate two reports to an output file called reports. txt:

Sales report Print the name, total sales, and commission for all reps entered into the system in the format shown below on sample output. Also calculate and print the total sales and commission of all reps.

Diamond Club Print the name and total sales of all reps with $10000 or more in total sales

Run your program with this file

James T. Kirk#8500 2650
Bruce Wayne#4880 3120
Harry Potter#1500 850
Peter Parker#9800 5100
Clark Kent#2750 1250
Lois Lane#8250 5200
Bob Blue#5125 7500
Steve Green#1200 3000
Jill White#1500 2500
Sam Black#5200 2800

For FULL credit you should create functions to:

-Read the file

-Calculate the commission for an individual

-Generate the sales report

-Generate the diamond club report

It is better to have working functionality WITHOUT functions than to run out of time … (you will lose 10% of the grade).

If you cannot use structures correctly, this program can be done by reading the file twice to generate each report. You will lose 10% of the grade for this option.

For full credit:

you MUST include comments that document the problem solving process

your code must be properly indented

your code will have functions

output should be formatted so that numbers align as in sample output

Make sure the answers are correct! I am purposely not showing the answers

SAMPLE RUN

Enter name of file: s. txt
s. txt not found, re-enter: sales. txt
Reading file
X records read

Report generated
Programmed by yournme

(in reports. txt)
Sales Report

Employee Total Sales Commission
Captain Kirk $ .xx $ .xx
Bruce Wayne $ .xx $ .xx
Harry Potter $ .xx $ .xx
Peter Parker $ .xx $ .xx
Clark Kent $ .xx $ .xx

Total $ .xx $ .xx

Diamond Club Qualified

Name Total Sales
rep $ .xx

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 19:30, alangonsales6232
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
image
Computers and Technology, 24.06.2019 13:20, sanaiajohnson56
In the insert table dialog box, you select the checkbox to create the first row as the header of the table.
Answers: 3
image
Computers and Technology, 24.06.2019 15:30, pineapplefun
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
image
Computers and Technology, 24.06.2019 17:40, katherinemoreno353
Write a program to analyze student’s scores. each student’s id and 4 original test scores are saved in the attached file “student_id_scores. txt”. assume there are exactly 15 students in the class.• the program first opens the file, reads student’s ids and scores from the file and saves them in two arrays: o create a one-dimensional string array “ids” to store the student’s ids. o create a (parallel) two-dimensional int array “scores” to store student’s original test scores. this array has 5 columns, the original 4 test scores should be saved in the first 4 columns, and the last column will be used to save the average score after the calculation in next step.• the program then retrieves test scores from the array “scores”, calculates average score and determines the final letter grade based on the rules in the table below for each student. assume average score is integer value. average score = (score1 + score2 + score3 + score4) / 4average score letter grade90 ~ 100 a80 ~ 89 b70 ~ 79 c60 ~ 70 d0 ~ 60 f• the average score should be saved back in the 5th column of “scores” array.• create a new parallel one-dimensional char array “grades” to save each student’s letter grade.• program also needs to find the number of a, number of b, number of c, number of d and number of f grade. as well as the highest, lowest and average score of the class.• finally, program will display all of the original scores and all results on the computer screen using the format shown as the sample output below.• the program must contain at least the following functions: (1) a function “getscores” to read and store data into “ids” and “scores” arrays.(2) a function “analyzescores” to calculate student’s average score, determine letter grade, get the number of a, b, c, d and f, find the highest, lowest and average score of the class.(3) a function “displayresults” to display all of the results
Answers: 3
Do you know the correct answer?
In C++ please. A company has sales reps that sell two different product lines. The sales amounts f...

Questions in other subjects:

Konu
Mathematics, 19.12.2020 05:00