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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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