Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Project Problem: Write a program that determines which of a company\'s four

ID: 3570665 • Letter: C

Question

C++ Project

Problem:
Write a program that determines which of a company's four divisions (North, South, East, West) had the greatest sales for a quarter. It must include the following functions exactly as specified:

getsales - this is a value returning function that will be passed the name of onedivision (North, South, East or West), it will prompt the user for the division's quarterly sales figures (be sure the prompt uses the name of the division passed in as a parameter), and then it will return the quarterly sales figure.

The function prototype is as follows: double getsales(string division);

You will need to call this function 4 times, once for each division.

A sample function call would look as follows: northsales = getsales("North"); and this should call the getsales function and prompt the user to enter the quarterly sales for the North division.

findHighest - this function will be passed the four sales figures and will determine the highest. The function will return both the highest sales figure and thedivision that had the highest sales figure (for this program you can assume no two divisions have the same sales figure). Keep in mind you can determine the highest sales figure with an if statement:

if (northsales > southsales && northsales > eastsales && northsales > westsales) then highest sales will be northsales and highestdivision will be "North"

displayHighest - this function will be passes the highest sales figure and thedivision with the highest sales and display both (formatted appropriately).

Explanation / Answer

#include<iostream>

using namespace std;

double getSales(string division ){
double sales;
cout << "Enter the quarterly slaes for " << division << " : " ;
cin >> sales;

return sales;
}

void findHighest(double *max, string *division, double north, double south, double east, double west){
if(north > south && north > east && north > west){
*max = north;
*division = "North";
}else if(south > north && south > east && south > west){
*max = south;
*division = "South";
}else if(east > south && east > north && east > west){
*max = east;
*division = "East";
}else{
*max = west;
*division = "West";
}
}

void displayHighest(double max, string division){
cout << division << " division has the maximum quarterly sales of " << max << endl;
}
int main(){
double north, south, east ,west, max;
string highest;
north = getSales("North");
south = getSales("South");
east = getSales("East");
west = getSales("West");

findHighest(&max, &highest, north, south, east, west);

displayHighest(max, highest);

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote