//Yousef Rabah
// Driving class prog.  TESTTANK.CPP

#include <iostream>
#include <cstdlib>
#include <cassert>
#include "tank.h"

using namespace std;

using namespace CS256_Asgn1;

void get_info ()
{
	cout<<endl;
	cout<<"To Add from liquid A ... Press a"<<endl;
	cout<<"To Add from liquid B ... Press b"<<endl;
	cout<<"To Draw from tank ... Press d"<<endl;
	cout<<"To quit ... Press q"<<endl;
	cout<<"-----------------------------------\n\n";
		
}	
int main ()
{
	char get_result;
	float amount;
	mixing_tank tank(500);
	
	get_info();
	cin >> get_result;
	while (get_result != 'q')
	{
		
		if(tank.is_empty())
		{
			cout<<"Tank: is empty \n";
		}
		else {
			cout<<"Tank:   Volume: "<<tank.get_volume()<<"  Percent A: "<<tank.get_mix();
			cout<<"  Space: "<<tank.get_space()<<endl;
		}
		
		
		switch (get_result)
		{
			case 'a':
			case 'A':
				cout<<"Amount: ";
				cin>>amount;
				if (amount > tank.get_space() || (amount < 0))
					cout<<"Warning, wrong entry...try again\n";
				else
					tank.add_A(amount);
				break;
				
			case 'b':
			case 'B':
				cout<<"Amount: ";
				cin>>amount;
				if (amount > tank.get_space() || (amount < 0))
					cout<<"Warning, wrong entry... try again\n";
				else
					tank.add_B(amount);
				break;
				
			case 'd':
			case 'D':
				cout<<"Amount: ";
				cin>>amount;
				tank.draw(amount);
				cout<<"Drew "<<amount<<endl;
				break;
				
			case 'q':
			case 'Q':
				exit(0);
							
				
				
			default:
				cout<<"Wrong Key, Please use small letter\n";
				get_info();
		}
		get_info();
		cin >> get_result;
	}


   return 0;
}

