I'm writing a program but I don't understand the question that well could someone help explain what I have to do. Also, I am having difficulty making the methods could someone help, because I am getting an error every time.
This is the Question.
Write a cash register class. It should have the following methods:

AddTransaction(amount) – add an amount to a running total and increments the number of transactions
TransactionCount() – returns the number of transactions received
Total() – returns to total amount of the orders
ResetTransactions() – sets the total amount and transaction count to 0
Register Count() – returns the number of cash registers created
Next, write an application that instantiates at least two register objects to prove that your class works.

P.S.: Don't worry about storing each individual order.

My code is:

package cashregister;
import java.io.*;
public class CashRegister 
{
    public static void main(String[] args) 
    {
        AddTransaction call = new AddTransaction();
        System.out.println("the answer is" + call);
        
        public static void AddTransaction()
        {
            String one = "";
            for (int i = 0; i <10;)
            {
                i++;
                one += i; 
            }
            System.out.println(one);
        }
        public static void TransactionCount()
        {
            AddTransaction count = new AddTransaction;
            
        }
    
        public static void Total()
        {
        }
    
        public static void ResetTransactions()
        {
        }
    
        public static void RegisterCount()
        {
        }    
     }
}

Your class (in a separate file) should start like this:

//CashRegister.java
public class CashRegister
{
	protected int m_intTransCount;
	protected double m_dblAmount;
	protected static int m_intObjCount = 0;
}

Inside that class, you should have a constructor, a finalize() and five other methods (like you've already done).

Once you have created that class, you should create another class with a main() in it that will create at least two CashRegister objects:

//UseCashReg.java
public class UseCashReg
{
	public static void main(String args[])
	{
		CashRegister cashReg1 = new CashRegister();
		System.out.println(cashReg1.RegisterCount());

		CashRegister cashReg2 = new CashRegister();
		System.out.println(cashReg1.RegisterCount());
	}
}

You can even use the other five methods you will create to increment and total amounts.

Comments
Thanks that was very helpfull
This question has already been answered. Start a new discussion instead.