/* KHOR YONG XIN (991113-07-6264) SECTION 02
   TEE HUI YOU (001005-10-1332) SECTION 02
   9/11/2019 
   QUESTION 1 */

#include <iostream>
using namespace std;

int getCoin ();
void calculateCoin (int &totalCoin, int coin);
int calculateBalance (int totalCoin);

int getCoin ()
{
	int x;
	
	cout << "Please enter the coin input: ";
	cin >> x;
	
	return x;
}

void calculateCoin (int &totalCoin, int coin)
{
	totalCoin += coin;
	
	cout << "The total coin input is " << totalCoin << " coins." << endl;
	cout << endl;
}

int calculateBalance (int totalCoin)
{
	int balance;
	
	balance = totalCoin - 120;
	cout << "The balance coin input is " << balance << " coins." << endl;
	cout << endl;
	
	return balance;
}

int main ()
{
	int totalCoin = 0, price = 120;
	int coin, balance;
	
	do
	{
	coin = getCoin (); 
	calculateCoin (totalCoin, coin);
	}
		
	while (totalCoin < price); 

	balance = calculateBalance (totalCoin);
	
	if (balance > 0)
		cout << "Please collect your balance.\n";
	
	cout << "TERIMA KASIH!\n";
	
	return 0;
}
