I am having an assignment of needing to create a code to calculate the sales of different divisions within the company and finding the division which has the highest sale, but I am not sure how I should begin.
Below is the directions I'd received. I just can't figure out the process and how to write such a code.
//declare the function prototypes here (before 'main', as explained in the book)
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"
I just can't figure out the process and how to write such a code.
Really?
I mean, main() is already there, you are required to write other two simple functions, about which you are provided with directions and also pseudocode…
Do try on your own before; ask for help if you are stuck.