Hey guys,
So I have 3 constructor classes and a main method. The three constructors are Product, LineItem, and Invoice. The main method is Cashier. In class Invoice, I'm trying to create a method called getRunningTotal() that scans through all the positions in the array and returns it's price and quantity. This is my method.
public double getRunningTotal() { double runningTotal=0; for(int i=0; i<numItems; i++) { runningTotal=runningTotal+collection[i].getPrice()*collection[i].getQuantity(); } return runningTotal; }
The method getPrice() is declared in the Product class, and getQuantity() is in my LineItem class.. What do I have to do to make Invoice recognize those methods?