You guys, I need some help so much! I canNOT figure out how to add items together to get the total price after they finish buying something.
Please would you have any ideas?
I know if I had variables like total, and amount, it would be ...
total = total + amount;
But those aren't my variable names, and this program has so many methods and stuff in it.
Any suggestions?? Here's part of my code..
public class PurchaseDemo1
{
public static void main(
String[] args)
{
Purchase1 oneSale = new Purchase1( );
char answer = 'y';
double finalBill = 0;
while (answer == 'y' || answer == 'Y')
{
oneSale.readInput( );
oneSale.writeOutput( );
System.out.println("*** Cost each $" + oneSale.getUnitCost( ));
System.out.println("*** Total cost $" + oneSale.getTotalCost( ));
System.out.println("*** Your final bill is $" + //HOW DO YOU GET THIS TOTAL??
System.out.println("Do you want to purchase more items? ");
System.out.println("Press y for yes, Press any other key to check out.");
answer = SavitchIn.readLineNonwhiteChar();
}
}
}
I'd appreciate any help you could give me.