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

  Techniques for information hiding and encapsulation

What techniques did you utilize for information hiding and encapsulation? Are there any improvements you would make? If so, what would they be?

  Lu decomposition with gauss elimination

The LU decomposition with Gauss elimination and what is the physical interpretation of the elements of ? Write C++ programs for steps 2, 3, and 4.

  Flipflaps - game based on pancake sorting

The project is to design and write a C++ 11/FLTK game program with a graphical user interface.The game is based on "pancake sorting,", which actually has some mathematical significance.

  Program to next the loops in either direction

You can write your program to next the loops in either direction, that is, process row-by-row or column-by-column. Explain which way you would choose to process the data.

  Ruby implement primitive types

How does Ruby implement primitive types, such as those for integer and floating-point data?  3-What is the single most important practical difference between Smalltalk and C++?

  Create if-then statement with single alternative decision

Create the If-Then statement (or a flowchart with a single alternative decision structure) which assigns 20 to  variable y and allots 40 to variable z if variable x is greater that 100.

  Change temperature fahrenheit to celsius and kelvin

Write a program in c++ that takes the temperature in Fahrenheit and convert it to Celsius And Kelvin:

  C program to randomly generate more than ten ip address

Write C or C++ program which Randomly generates more than 10 IP addresses written in decimal format and write results in text file (e.g. Dec_IPAddresses.txt)

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Base process which communicate with child processes

Write a program which has a "base process" which communicates with child processes acting as "bombers" that it creates.

  Time conversion

Write a C++ program that takes an Eastern standard time in hours, minutes, and seconds,and prints it out in Central time, Mountain time, or Pacific time.

  Write program to count occurrences of each word in text

Write down C++ program to read following text. Count occurrences of each word in text and keep this count in list of elements containing (word, occurrence count) pairs.

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