//OrinTill Qimid CS1A Chapter 4, P. 369, 3
//
/**************************************************************
 * HIGHEST SALES DIVISON
 * 
 * ____________________________________________________________
 * This program will find the highest sales among 4 division
 * ____________________________________________________________
 * INPUT
 * sales : the sales of each divison
 * OUTPUT
 * highestDivision : highest sales divison
 * highestSales : highest sales number
 **************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double getSales(string name);
void findhighest(float northeast, float southeast, float northwest, float southwest);
int main() 
{
    
    
    double northeast = getSales("Northeast");
    double southeast = getSales("Southeast");
    double northwest = getSales("Northwest");
    double southwest = getSales("Southwest");
    findhighest(northeast,southeast,northwest,southwest);
	return 0;
}

double getSales(string name)
{
    double sales;
    cout<<"Whats the sales of "<<name<<""<<endl;
    cin>>sales;
    while (sales<0)
    {
        cout<<"please eneter a vaild amount of sales"<<endl;
        cin>>sales;
    }
    
    return sales;
   }
   
   void findhighest(float northeast, float southeast, float northwest, float southwest)
   {
    string highestDivision;
    double highestSales;
    if (northeast > southeast && northeast > northwest && northeast > southwest) {
        highestDivision = "Northeast";
        highestSales = northeast;
    }
    else if (southeast > northeast && southeast > northwest && southeast > southwest) {
        highestDivision = "Southeast";
        highestSales = southeast;
    }
    else if (northwest > northeast && northwest > southeast && northwest > southwest) {
        highestDivision = "Northwest";
        highestSales = northwest;
    }
    else {
        highestDivision = "Southwest";
        highestSales = southwest;
    }

    // Display the division with the highest sales
    cout << "The " << highestDivision << " division had the highest sales: $" << highestSales << endl;
    
   }