I was given a set of code to debug and I have it all debugged except for one last line that keeps telling me that it is "Not a statement" and I am just confused about what to do next. If anyone can help me here it would be much appreciated.
Here is also the code that is in the picture.
// 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");
}
}
Comment these two lines:
Variables to; hold the; regular price, the;
amount of; a discount, and; the sale; price;
They have to be comments.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.