为什么我一直收到错误
未找到符号
代表hamburger
,cheeseburger
等?我也收到*
符号的错误。我用一个模板来创建这个程序。我不明白它为什么不编译。
import java.util.Scanner;
import java.text.NumberFormat;
public class Assignment2
{
public static void main (String[] args)
{
final (double) HAMBURGER_COST = 2.75;
final (double) CHEESBURGER_COST = 3.25;
final (double) FRENCHFRIES_COST = 2.50;
final (double) BEVERAGE_COST = 1.50;
String hamburger, cheeseburger, fries, beverages;
Scanner in = new Scanner(System.in);//allows user input
System.out.println("Welcome to the In-N-Out Burger menu:");
System.out.println("______________________________________");
System.out.println("Hamburger $2.75");
System.out.println("Cheeseburger $3.25");
System.out.println("French Fries $2.50");
System.out.println("Shake & Beverage $1.50");
System.out.print("How many hamburger(s) would you like to buy?");
hamburgers = scan.nextInt();
System.out.print("How many cheeseburger(s) would you like to buy?");
cheeseburgers = scan.nextInt();
System.out.print("How many French fries would you like to buy?");
fries = scan.nextInt();
System.out.print("How many drinks would you like to buy?");
beverages = scan.nextInt();
double hamburgerCost = (double)HAMBURGER_COST * hamburger;
double cheesebugerCost = (double)CHEESBURGER_COST * cheeseburger;
double frenchfriesCost = (double)FRENCHFRIES_COST * fries;
double beverageCost = (double)BEVERAGE_COST * beverages;
double orderCost = (double)hamburgerCost + (double)cheesebugerCost +
(double)frenchfriesCost + (double)beverageCost;
int numberItems = Hamburgers + Cheesburgers + Fries + Beverages;
NumberFormat fmt1 = NumberFormat.getCurrencyInstance();
System.out.println("Hamburger Cost : " + fmt1.format(hamburgerCost));
System.out.println("Cheeseburger Cost : " + fmt1.format(cheesebugerCost));
System.out.println("French Fries Cost : " + fmt1.format(frenchfriesCost));
System.out.println("Order Cost : " + fmt1.format(beverageCost));
System.out.println("Shake & Beverage Cost : " + fmt1.format(beverageCost));
System.out.println("Total number of items ordered : " + numberItems);
}
}