//Mahmoud Saleh                               CSC5                               Chapter 5 #17, P297
//
/****************************************************************************************************
*
* Compare Store Sales
*________________________________________________________________________________
* This Program will compare The sales of 5 different stores
* and display them in a bar graph
* This program accepts sales data from a number of stores and displays those data
* in the form of a bar graph.
*
*_________________________________________________________________________________
* INPUT
*	storeData       :      The revenue of each store
*	Number of stores
*	Plot symbol
*
* OUTPUT
* 	store1     :      Amount made by store 1 represented by '*'
*	store2     :      Amount made by store 2 represented by '*'
* 	store3     :      Amount made by store 3 represented by '*'
* 	store4     :      Amount made by store 4 represented by '*'
* 	store5     :      Amount made by store 5 represented by '*'
* 	bar graph comparing stores using '*'
*	A traditional bar graph representing the sales of each store by store.
*
****************************************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main()
{
	//Declaring variables
	int count;
	int count2;
	int count3;
	int store;
	int storeNum;
	string storeStar;
	string store1;
	string store2;
	string store3;
	string store4;
	string store5;

	//Initializing variable storeNum
	storeNum = 1;

	//Establishing for loop to run for 5 iterations
	for(count = 0; count<5; count++)
	{
		//Initializing and resetting variables
		count3 = 0;
		store = 0;
		count2 = 0;
		storeStar = "";
		
		//Using while loop to validate input making sure its a positive integer
		while(count3<1)
		{	
			cout << "Enter today's sales for store " << count + 1 << ":\n";
			cin >> store;
			//If statement if input value is negative
			if (store < 0)
				cout << "Invalid Input try again.\n";
			else
				count3 += 1;
		}		
		//Dividing input value by 100 and reassigning it for comparison 
		store /= 100;	
		
		//While loop to assign "*" points to the store based on input
		while (count2 < store)
		{
			storeStar += "*";
			count2 += 1;
		}
		
		//Switch statement to assign the total points to the exact store
		switch(storeNum)
		{
			case 1:
				store1 = storeStar;
				break;
			case 2:
				store2 = storeStar;
				break;
			case 3:
				store3 = storeStar;
				break;
			case 4:
				store4 = storeStar;
				break;
			case 5:
				store5 = storeStar;
				break;
		}
		
		//Statement to ensure next input is given to the next store
		storeNum += 1;
	}

		//Displaying comparison bar graph
		cout << endl;
		cout << "SALES BAR CHART" << endl;
		cout << "(Each * = $100)" << endl;
		cout << "Store 1: " << store1 << endl;
		cout << "Store 2: " << store2 << endl;
		cout << "Store 3: " << store3 << endl;
		cout << "Store 4: " << store4 << endl;
		cout << "Store 5: " << store5 << endl;

	return 0;
}