//IMRAN HAKIM BIN NORASMADI
//AINA ALIAH BINTI RUSLAN
//SECTION 2
#include <iostream>
using namespace std;

int getCoin();
void calculateCoin(int &totalCoin , int coin);
int calculateBalance(int totalCoin);
int main(){
	int total = 0, price = 120, coin, balance;
	do{
		
		coin = getCoin(); //calls for coin input
		calculateCoin(total, coin); //calculates the total number of coins entered
		
	} while(total < price); //to check if the total coins entered is greater than the price
balance = calculateBalance(total);
if( balance > 0){
		cout << "Please collect your balance" << endl;
		cout << "\tTERIMA KASIH";
	} else{	
	cout << "\tTERIMA KASIH";
}
} 

int getCoin(){
	//reads the value of a coin input from the user
	int c;
	cout << "Please enter coins : ";
	cin >> c;
	return c;
}

void calculateCoin(int &totalCoin , int coin){
	//calculate the total coins entered by the user and display the total amount
	totalCoin += coin;
}

int calculateBalance(int totalCoin){
	//compute the balance of the coin and display the balance amount
	int balance , price = 120;
	balance = totalCoin - price;
	cout << "The balance is : " << balance << endl;
	return balance;
	
}

