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 song playlist class-object-oriented design principles

Write a song playlist class in C++ called "PlayList" using object-oriented design principles. The playlist should support the following ADT.The implementation should be based on an array of strings to store the song titles.

  Write program which reads n numbers from keyboard

Write down C++ program which reads N numbers (positive, negative, integer and double numbers) from keyboard, computes and shows the following information. Largest number of all numbers entered from keyboard.

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Write and test c program which outputs waveform

Write and test a C program which outputs waveform which switches from 10.0 kHz with a 50% duty cycle to 25.0 kHz with a 5% duty cycle every 5 seconds.

  Write program which inputs number of winning coupons

Write a program which inputs number of coupons you win and outputs how many candy bars and gumballs you can get if you spend all off your coupons on candy bars first and remaining coupons on gumballs in c++.

  Prepare a program for a retail-mart company

Prepare a program for a company Retail-Mart.

  Implement method to advance any given date by one day

Write C++ implementation of this method. Create and specify any other methods that you require. Include comments which will be helpful to someone who will maintain implementation in the future.

  Multiple heaps

Create an application that has two heaps. Place a linked list into each heap. Select one hundred random numbers. Place each of the random numbers into each heap - CSI 345 - Spring 2014 S2

  Write c program for linked list applications

Write a complete C program which illustrates the Linked list applications data structures and algorithms. The program will read in mid-semester test scores as Main Linked List and produce six outputs:

  Construct vector and linked lists data structures

You will prepare sorted versions of the Linked Lists and Vector data structures developed in class

  Loops and if conditions

Write a program that requests a password

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