繁体   English   中英

我似乎无法弄清楚接下来要做什么。 它一直说“不是声明”

[英]I can't seem to figure out what to do next. It keeps saying “Not a statement”

我得到了一组要调试的代码,除了最后一行一直告诉我它是“不是声明”之外,我已经调试了所有代码,我只是对下一步要做什么感到困惑。 如果有人能在这里帮助我,我将不胜感激。

错误信息截图

这也是图片中的代码。

// This program calculates the sale price of an
// item that is regularly priced at $59, with
// a 20 percent discount subtracted.

import java.util.Scanner;  // Needed for the Scanner class

public class Discount
{
   public void main(String[] args)
   {
      Variables to; hold the; regular price, the;
      amount of; a discount, and; the sale; price;
      double regularPrice = 59.0;
      double salePrice;
      
      // Create a Scanner object to read input
      scanner keyboard = new Scanner(System.input);
      
      // Get the regular price
      System.out.print("Enter regular price");
      regularPrice = key.next();
      
      // Calculate the amount of a 20% discount.
      discount = regularPrice * 0.20;
      
      // Calculate the sale price by subtracting
      // the discount from the regular price.
      salePrice = regularPrice - discount;
      
      // Display the results.
      system.println("Regular price: $ + regularprice");
      system.println("Discount amount: $ + discount");
      system.println("Sale price: $ + total");
   
}
}

注释这两行:

Variables to; hold the; regular price, the;
amount of; a discount, and; the sale; price;

他们必须是评论。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM