[英]A compiling Error I cannot figure out in BlueJ
I am getting the ')' expected error when I try to compile on one of my print f statements.当我尝试在我的 print f 语句之一上进行编译时,我收到了 ')' 预期错误。 The project is to write an application that will run on cash registers in a pizza restaurant.该项目是编写一个将在比萨餐厅的收银机上运行的应用程序。 Here is the section of code.这是代码部分。 The problem line is the one inside the double asterisks.问题行是双星号内的行。 Any ideas?有任何想法吗?
System.out.println();
System.out.println (" Order Summary ");
System.out.println (" *************************");
System.out.println ();
if(NofTopp = 0){
System.out.printf( Size + ", " + crust + " Cheese Pizza : $%.2f", cost);
System.out.println();
}else if(NofTopp = 1){
System.out.printf( Size + ", " + crust + " Pizza with " + Top1 + ": $%.2f", cost);
System.out.println();
}else if(NofTopp = 2){
**System.out.printf (Size + ", " + crust + " Pizza with " + Top1 + " and " + Top2 ": $%.2f",
cost);**
System.out.println();
}else if(NofTopp = 3){
System.out.printf( Size + ", " + crust + " Pizza with " + Top1 + ", " + Top2 + " and " + Top3 +
": $%.2f", cost);
System.out.println();
}
System.out.printf ("Tax: $%.2f",SalesTax );
System.out.println();
System.out.printf ("Total: $%.2f",totalCost );
System.out.println();
I think you forgot a +
before the ": $%.2f"
.我认为您在": $%.2f"
之前忘记了+
。 Try:尝试:
System.out.printf (Size + ", " + crust + " Pizza with " + Top1 + " and " + Top2 + ": $%.2f", cost);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.