Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program should calculate which division in a company had the greatest sales for a quarter. It should use the following functions: A function should

This program should calculate which division in a company had the greatest sales for a quarter. It should use the following functions:

A function should ask the user for and return the quarterly sales figures for the company's Northeast, Southeast, Northwest, and Southwest divisions.

A function should determine which division had the highest sales figures.

A message should be displayed indicating the leading division and its sales figures for the quarter.

Input Validation: Do not accept dollar amounts less than $0.00.

Additional note: The following code for the main function is a required starting point. Create the functions and corresponding prototypes to make this work.

//declare the function prototypes here (before 'main', as explained in the book)

#include

#include

int main()

{

float nE, sE, nW, sW;

nE = input_div( "North East" );

sE = input_div( "South East" );

nW = input_div( "North West" );

sW = input_div( "South West" );

findHighest(nE, sE, nW, sW); //prints the result also

return 0;

}

//************ subroutine definitions below *******************

float input_div( string name)

{

Code inputs dollar value for given division and returns it

(Use a while or do/while loop for validation)

}

Note: this function receives the name of the division

('NorthEast', 'SouthEast', etc.) under 'name', which will appear on the prompt

for its sales input.

void findHighest ( receiving 4 'float' types )

{

Code determines the biggest of 4 floats and

prints the result to the screen.

Note: No need to worry about duplicates in this exercise.

Though, there is a 1 point extra credit for implementing

duplicate top divisions - make it clear in the header comments that this was done.

}

Pseudocode for findHighest(). Use extra variables

to keep track of the highest value and its corresponding name. Assign these

variables the first values of the data and continue checking for and updating

the highest data, like this:

highest = nE

name = "North East"

if sE > highest then

highest = sE

name = "South East"

if nW > highest then

highest = nW

name = "North West"

if sW > highest then

highest = sW

name = "South West"

cout "the highest is " name "with" highest

return 0;

}

(but do use two decimals)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions