Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help trying compile the program but getting this error on line 107 expect '}' at the end of input. Write a program that determines

need help trying compile the program but getting this error on line 107 expect '}' at the end of input.

Write a program that determines which of a company's eight divisions (North, South, East, West, Northeast, Southeast, Northwest, Southwest) had the greatest sales for a quarter. It should include the following two functions which are called only by main.

double getSales() - it is passed the name of a division. It asks the user for a division's quarterly sales figure, validates the input then returns it. It should be called once for each division. Negative dollar amounts are invalid.

void findHighest() - it is passed the eight sales amounts. It then determines which is the largest and prints the name of the high grossing division along with it's sales figure.

#include

#include

#include

double getSales(); void findHighest(double, double, double, double, double, double , double, double); int main() { double North, South, East, West, Northeast, Southeast, Northwest, Southwest;

std::cout << "Enter the quarterly sales for North Division: " << std::endl; North = getSales(); std::cout << "Enter the quarterly sales for South Division: " << std::endl; South = getSales(); std::cout << "Enter the quarterly sales for East Division: " << std::endl; East = getSales(); std::cout << "Enter the quarterly sales for West Division: " << std::endl; West = getSales(); std::cout << "Enter the quarterly sales for Northeast Division: " << std::endl; Northeast = getSales(); std::cout << "Enter the quarterly sales for Southeast Division: " << std::endl; Southeast = getSales(); std::cout << "Enter the quarterly sales for Northwest Division: " << std::endl; Northwest = getSales(); std::cout << "Enter the quarterly sales for Southwest Division: " << std::endl; Southwest = getSales(); findHighest(North, South, East, West, Northeast, Southeast, Northwest, Southwest); return 0; } double getSales() { double sales; std::cin >> sales; if(sales < 0) { std::cout << " Error: Invalid figures please enter above zero" << std::endl; exit(0); } return sales; } void findHighest(double North,double South,double East,double West, double Northeast,double Southeast,double Northwest,double Southwest) {

if (East > West && North > South) { if(North > South) { std::cout << "The North division had the greatest number of sales, $"; std::cout << North << std::endl; }

if (North > South && West > East) { if(West > East) { std::cout << "The West division had the greatest number of sales, $"; std::cout << West << std::endl; }

if (North > South && East > West) { if(East > West) { std::cout << "The East division had the greatest number of sales, $"; std::cout << East << std::endl; }

if (East > West && South > North ) { if(South > North) { std::cout << "The South division had the greatest number of sales, $"; std::cout << South << std::endl; }

if (Northeast > Southeast && Northeast > Northwest) { if(Northeast > Southwest) { std::cout << "The Northeast division had the greatest number of sales, $"; std::cout << Northeast << std::endl; } } if (Southeast > Northeast && Southeast > Northwest) { if(Southeast > Southwest) { std::cout << "The Southeast division had the greatest number of sales, $"; std::cout << Southeast << std::endl; } } if (Northwest > Northeast && Northwest > Southeast) { if(Northwest > Southwest) { std::cout << "The Northwest division had the greatest number of sales, $"; std::cout << Northwest << std::endl; } } if (Southwest > Northeast && Southwest > Southeast) { if(Southwest > Northwest) { std::cout << "The Southwest division had the greatest number of sales, $"; std::cout << Southwest << std::endl; exit (0);}

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

Step: 3

blur-text-image

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Know the three main dimensions of the service environment.

Answered: 1 week ago