954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

what is wrong with this code? (very simple)

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);
  
  
  }
}
isebas
Newbie Poster
15 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

One is the semicolon after your statement of main method.

darwin_nacional
Newbie Poster
5 posts since Jul 2011
Reputation Points: 10
Solved Threads: 1
 
One is the semicolon after your statement of main method.


Very simple...gracias!

isebas
Newbie Poster
15 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

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);
bryanvon
Light Poster
31 posts since Nov 2010
Reputation Points: 11
Solved Threads: 3
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: