Reference no: EM13158793
Part 1:
Write a program that asks the user to enter the names of three salesmen. The program should then
accept the sales produced for salesman for each quarter of the year. Display the name, and the total
sales amount, of each salesman.
hint: Consider using two arrays in parallel. One array holds the name of the salesman (string data type)
and the other array holds the sales numbers (double data type). Since the data for each salesman is of
different data types, you cannot use one array to hold all of the data (An array is a collection of identical
data types). Arrays are considered to be parallel if one of the subscripts in each array references the
same thought (e.g. name[1] holds the name for the second salesman and the sales data for the second
salesman would be in sales[1]... ).
Hint: It is possible to solve this problem using a two dimensional array to hold the sales data with one
dimension referring to quarter and the other dimension referring to the sales amount for the
quarter. See if you can solve the problem, by calculating the total sales for each salesman as the data is
entered and storing only the names of the salesman and the total sales for each salesman.
Consider whether this problem could actually be solved without arrays.
You must not use global variables.
Here is some sample output:
Enter in the name for salesman 1: Margaret[Enter]
Now enter in the sales for each quarter for Margaret
Enter in data for quarter 1: 45676[Enter]
Enter in data for quarter 2: 55768[Enter]
Enter in data for quarter 3: 98376[Enter]
Enter in data for quarter 4: 109873[Enter]
Enter in the name for salesman 2: Robert[Enter]
Now enter in the sales for each quarter for Robert
Enter in data for quarter 1: 23987[Enter]
Enter in data for quarter 2: 43976[Enter]
Enter in data for quarter 3: 97658[Enter]
Enter in data for quarter 4: 99876[Enter]
Enter in the name for salesman 3: Leo[Enter]
Now enter in the sales for each quarter for Leo
Enter in data for quarter 1: 8765[Enter]
Enter in data for quarter 2: 56743[Enter]
Enter in data for quarter 3: 97685[Enter]
Enter in data for quarter 4: 108012[Enter]
Total sales for Margaret is $309693.00
Total sales for Robert is $265497.00
Total sales for Leo is $271205.00
Part 2:
Extend part 1 such that the name, and the corresponding sales amount, of the salesman
who sold the highest sales are displayed for each quarter.
You must not use global variables.
Here is a sample output:
Enter in the name for salesman 1: Leo[Enter]
Now enter in the sales for each quarter for Leo
Enter in data for quarter 1: 23001[Enter]
Enter in data for quarter 2: 82002[Enter]
Enter in data for quarter 3: 56003[Enter]
Enter in data for quarter 4: 95004[Enter]
Enter in the name for salesman 2: Jane[Enter]
Now enter in the sales for each quarter for Jane
Enter in data for quarter 1: 93011[Enter]
Enter in data for quarter 2: 37012[Enter]
Enter in data for quarter 3: 81013[Enter]
Enter in data for quarter 4: 94014[Enter]
Enter in the name for salesman 3: Judy[Enter]
Now enter in the sales for each quarter for Judy
Enter in data for quarter 1: 43710[Enter]
Enter in data for quarter 2: 83721[Enter]
Enter in data for quarter 3: 92732[Enter]
Enter in data for quarter 4: 92177[Enter]
Salesman Jane had the highest sales for quarter 1 with $93011.00
Salesman Judy had the highest sales for quarter 2 with $83721.00
Salesman Judy had the highest sales for quarter 3 with $92732.00
Salesman Leo had the highest sales for quarter 4 with $95004.00
Define batting averages of baseball players are reported
: Batting averages of baseball players are reported in parts per thousand. what would be the batting average of a hitter
|
Show the relative wage in home lies
: Show the relative wage in Home lies in between the relative productivity of labour of two sectors using the information you obtained from parts j and k.
|
Sarah contribution cost
: Sarah contributes 25K to a church. Sarahs marginal tax rate is 35%. While her average tax rate is 25%. After considering her tax savings, sarah's contribution cost are?
|
What is the molar mass of the solute
: The boiling point of a solution containing 10.44 g of an unknown nonelectrolyte in 50.00 g of acetic acid is 159.2°C. What is the molar mass of the solute?
|
Write a program that asks the user to enter the names of 3
: Write a program that asks the user to enter the names of three salesmen. The program should thenaccept the sales produced for salesman for each quarter of the year. Display the name, and the totalsales amount, of each salesman.
|
What is the freezing point of a solution
: What is the freezing point of a solution of 1.17 g of 1-naphthol, C10H8O, dissolved in 2.00 mL of benzene at 20°C? The density of benzene at 20°C is 0.876 g/mL. Kf for benzene is 5.12°C/m, and benzene's normal freezing point is 5.53°C.
|
Driving force causing this evolution
: Discuss the evolution of client-server computing from file server to multilayer applications to Web-based applications. What has been the driving force causing this evolution? Where do you think network computing will be in the next five years? Ten y..
|
Compute the internal energy change for vaporization
: where its latent heat of vaporization is 20.4 kJ/mol. Its molar mass is 70.91 g/mol. (a) Calculate the internal energy change (deltaU) for vaporization of 100 g of Cl2(liq.)
|
What is the percent yield
: 825grams of NO are produced from the reaction of 500grams of NH3 with excess oxygen, what is the percent yield?
|