Question related to Java -Can anyone please advise and help me, thanks

This is my question

  1. Creat a class named Calculate
  2. Add 2 instance variables, Quantity & Unit Price
  3. Add no argument constructor
  4. Add getters and setters for the 2 instance variables
  5. Add user defined method named Total with no arguments. Total will calculate and return Quantity * Price. If Quantity is greater than 10, give 5% discount
  6. Add user defined method to display total amount to the user
  7. Create a Java main app to create 2 objects based on Calculate class to test the program

So far this is my code:

    import java.util.Scanner;
    public class Calculate {
    public static void main (String args []) {
    Scanner Quantity= new Scanner(System.in);
    System.out.println(“Enter Quantity”);
    double quantity=sc.nextDouble();
    System.out.println(“Enter Price”);
    double price=sc.nextDouble();
    sc.close();
    double total=quantity*price;
    System.out.println(“The total is:” + total);
    }
}

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

What problems are you having? What questions do you have?

Do you want to know the answer to the question? or instruction to get to the answer?