//KONG PUI CHEONG AD1 ASSIGNMENT 6
public class PennyJar
{
	// declare p : no. of penny , ni : no. of nickel , d : no. of dime
	int p;	
	public PennyJar()
	{
		p=0;
	}
	public PennyJar(int n)
	{
		p=n; // add some codes here
	}

	public void takePenny()
	{
		if (p>=1)
                p--;	// you should ensure p is always >= 0
	else
                System.out.println("There is not enough pennies in the jar");
        }

	public void addPenny()
	{
                p++;
	}

	public void takePenny(int n)
	{
		if (p>=n)
                p = p - n;	// you should ensure p is always >= 0 
	else
                System.out.println("There is not enough pennies in the jar");
	}
	public void addPenny(int n)
	{
		p = p + n;
	}
	public void addNickel()
	{
		p=p+5; // add some codes here
	}
	public void addNickel(int n)
	{
		p = p + (5*n); // add some codes here
	}
	public void addDime()
	{
		p=p+10; // add some codes here
	}
	public void addDime(int n)
	{
		p = p + (10*n); // add some codes here
	}
	public int total()
	{
		return p;
	}
	//public int totalNickel()
	//{
		//p = ni + ni1; // add some codes here
		//return -1;
	//}
	//public int totalDime()
	//{
		//p = d + d1; // add some codes here
		//return -1;
	//}
}