Yes, I am a total newbie. I am doing this code for homework. It is giving me an error on the method line is saying that it is missing.Please help.

import java.io.*;
public class discount
 
  {public static input in = new input();
    
public static void main(String[] args) throws IOException;
  {double price,disc,total,perc;
  
  System.out.println("Please enter price: ");
  price = in.getDouble();
  
  System.out.println("please enter discount percentage rate: ");
  disc = in.getDouble();
  
  perc = price(disc/100);
  
  total = price - perc;
  System.out.println("Your total cost is: "+total);
  
  
  }
}

One is the semicolon after your statement of main method.

One is the semicolon after your statement of main method.

Very simple...gracias!

1st error - semicolon after your IOException in you main method declaration
2nd error - i think it's in here

public static input in = new input()

maybe you need to import the class where input type is located. by the way what are you trying to do? get input from the user? may you should use java.util.Scanner
Example:

Scanner in = new Scanner(System.in);
      System.out.println("Enter username:");
      String username = in.nextLine();
      System.out.println(username);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.