Итак, я помогаю другу с вопросом программирования, и никто из нас не может понять, почему amountBurger, amountChickenSandwich, amountTaco, amountNachos или amountFries недоступны в toString()
в нижней части кода
'''/*
*
*/
package edu.ilstu;
import java.util.Scanner;
/**
* <tracks the amount of all orders for the day>
*
* @author
*
*/
public class OrderClass
{
Scanner scan = new Scanner(System.in);
public static final double BURGER = 5.00;
public static final double FRIES = 2.50;
public static final double TACO = 2.00;
public static final double NACHOS = 6.50;
public static final double CHICKEN_SANDWICH = 5.25;
public static final double SMALL_DRINK = 1.25;
public static final double MEDIUM_DRINK = 1.75;
public static final double LARGE_DRINK = 2.25;
private double price;
private int amountBurger, amountFries, amountTaco, amountNachos, amountChickenSandwich, amountSmallDrink, amountMediumDrink, amountLargeDrink, count;
private boolean delivery;
public void order(int amountBurger, int amountFries, int amountTaco, int amountNachos, int amountChickenSandwich, int amountSmallDrink, int amountMediumDrink, int amountLargeDrink)
{
}
public void orderPrice()
{
this.price = amountBurger * BURGER + amountFries * FRIES + amountTaco * TACO + amountNachos * NACHOS + amountChickenSandwich * CHICKEN_SANDWICH + amountSmallDrink * SMALL_DRINK + amountMediumDrink * MEDIUM_DRINK + amountLargeDrink * LARGE_DRINK;
}
public int getAmountBurger()
{
return amountBurger;
}
public void setAmountBurger(int amountBurger)
{
this.amountBurger = amountBurger;
}
public int getAmountFries()
{
return amountFries;
}
public void setAmountFries(int amountFries)
{
this.amountFries = amountFries;
}
public int getAmountTaco()
{
return amountTaco;
}
public void setAmountTaco(int amountTaco)
{
this.amountTaco = amountTaco;
}
public int getAmountNachos()
{
return amountNachos;
}
public void setAmountNachos(int amountNachos)
{
this.amountNachos = amountNachos;
}
public int getAmountChickenSandwich()
{
return amountChickenSandwich;
}
public void setAmountChickenSandwich(int amountChickenSandwich)
{
this.amountChickenSandwich = amountChickenSandwich;
}
public int getAmountSmallDrink()
{
return amountSmallDrink;
}
public void setAmountSmallDrink(int amountSmallDrink)
{
this.amountSmallDrink = amountSmallDrink;
}
public int getAmountMediumDrink()
{
return amountMediumDrink;
}
public void setAmountMediumDrink(int amountMediumDrink)
{
this.amountMediumDrink = amountMediumDrink;
}
public int getAmountLargeDrink()
{
return amountLargeDrink;
}
public void setAmountLargeDrink(int amountLargeDrink)
{
this.amountLargeDrink = amountLargeDrink;
}
public boolean getDelivery()
{
return delivery;
}
public void setDelivery(boolean delivery)
{
this.delivery = delivery;
}
public void count()
{
this.count= count + 1;
}
public String toString(int orderSelection)
{
if(orderSelection == 1)
{
return "Burger - $5.00" + "\nHow many do you want? ";
//amountBurger = scan.nextInt();
}
else if(orderSelection == 2)
{
return "Chicken Sandwich - $5.25" + "\nHow many do you want? ";
amountChickenSandwich = scan.nextInt();
}
else if(orderSelection == 3)
{
return "Taco - $2.00" + "\nHow many do you want? ";
amountTaco = scan.nextInt();
}
else if(orderSelection == 4)
{
return "Nachos - $6.50" + "\nHow many do you want? ";
amountNachos = scan.nextInt();
}
else
{
return "Fries - $2.50" + "\nHow many do you want? ";
amountFries = scan.nextInt();
}
}
} '''