Write a program that asks the user to enter the names of 3

Assignment Help C/C++ Programming
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

 

 

Reference no: EM13158793

Questions Cloud

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?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Insert the missing code in the c program

You are to insert the missing code in the C program given for combinational equivalence checking. This program will interface with the CUDD package and will parse netlist files in ISCAS85 circuit format. Next, BDDs will be created for each circuit an..

  Prepare a linear support vector machine svm

Write a computer program to prepare a Linear Support Vector Machine SVM

  Computer programming using c language lab

Computer programming using c language lab

  Uml diagram of all the classes

Speaking of converting into the correct object-type, the goal of the factory is to abstract away object creation.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Program to translates letter grade into number grade

In C++ (should be able to compile in Visual Studio 2010): Write a program to translates letter grade into number grade. Letter grades are A,B,C,D and F, possibly followed by a + or -.

  Write c program to add two integers and prints out average

Write a C program that prompts for a variable number of integers, adds them up, and prints out the average. The user will enter either an integer to be averaged.

  Illustrate example from ansi c programming language

Illustrate example from ANSI C programming language, without using nested procedures, to show the fact that "assignment-by-sharing in conjunction with quasi-dynamic object binding

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

  Write program to perform add-drop-list and update functions

Write C++ program to do add, drop, list (in last name / first name sorted order or id) and update functions. separate UI from data processing use object programming method multiple files

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd