簡體   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