The 2 answers posted both fixed it. thank you very much and i am embarrassed by how simple it was.
sorry for posting such a basic question and thank you for your time.
From the menu method at the top i wish to call 2 different methods to complete an action based on the input. i cannot find anywhere how to call a void method.
I don't know why the second one wont work as i used a similar thing earlier on.
public void CheckOutMenu(ArrayList basket )
{
choice = 0;
while ( choice !=4 ) {
Scanner in = new Scanner ( System.in);
{
switch(in.nextInt()){
//print the number of items in the basket
case 1:
//working
break;
case 2:
//dont know how to call on option 2 the listBasket method
break;
case 3:
//to call the method
//error and wont compile
double totalCost = CalcTotalCost(totalCost = 0);
//printing what the method returns
System.out.print("The total price of your basket is £" );
break;
case 4:
choice = 4;
break;
default:
System.out.println("please enter a whole number that represents you're choice");
}
}
}
}
protected void listBasket(ArrayList basket )
{
//code inside works fine
}
public double CalcTotalCost(double total, ArrayList basket)
{
//code inside works fine
return total;
}