Results 1 to 8 of 8
  1. #1
    vhengIT's Avatar
    vhengIT is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Red face Badly Need Help...T_T..thnx

    hi mods..am new here..this is my first time to post here..btw..can someone check the errors on my work..am very poor in java..am a 1st year college taking up IT..am using notepad and command promt..my work dosnt run coz too many errors..may someone check this out..thnxx

    import java.io.*;
    public class Help{
    public static void main(String args[]);
    BufferedReader reader=new BufferedReader(New input StreamReader(System.in));
    Float B;
    Float F;
    Float C;
    Float S;
    System.out.print("Enter the value for B");
    System.out.print("Enter the value for F");
    System.out.print("Enter the value for C");
    System.out.print("Enter the value for S");
    try{
    F=float.parseFloat(reader.readLine);
    C=float.parseFloat(reader.readLine);
    S=float.parseFloat(reader.readLine);
    F=F-(B*2);
    C=C-B;
    S=S-B;
    }
    catch(Exception e){
    System.out.print("Error");
    }
    System.out.println("The Equivalent in Fudge"+F)
    System.out.println("The Equivalent in Cookies"+C)
    System.out.println("The Equivalent in Square"+S)
    }
    }


    I think this is very easy for Pro's like you guys..and plss point out wheres my errors are..thnx a lot..
    :o :o :o :confused: :confused: :confused: :( :( :(

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    > I think this is very easy for Pro's like you guys.

    Easy, but a bit pointless.

    Why don't you say what the compiler messages are if you don't understand them? That way people can tell you what they mean and you can then fix them.

  3. #3
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    828
    Rep Power
    6

    Default

    Hi,
    One small tip for u.
    U are a brand new person for programming.These are the things u
    need to do.
    1.Read one by one topic and once completion of each topic u do
    some code related to that for making the syntax perfect

    Just take a notepad or piece of paper and write one by one as a
    point what you want to do exactly.
    Then start with the code and you can complete perfectly.

    In your code lot of syntax errors.

    -Regards
    Ramya
    Ramya:cool:

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default

    First off stick your code in CODE tags (there's a # button above the message box).

    Secondly (as requested above) how about posting your compiler errors.

    Next, Java is case sensitive...that is New is not the same as new.

    And, as a starter:
    Java Code:
    public static void main(String args[]); // <-- semi-colon?

  5. #5
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    7

    Default

    Hey vhengIT. Welcome to Java Forums! :D Check your Personal Messages. ;)

    Tim
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  6. #6
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Default

    HI vhengIT,
    Your program has too many syntax errors. If you want to learn java, start by reading chapter by chapter as Ramya suggested.
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  7. #7
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    Since you are new to programming, I'll join in on the tips for you:

    1. Read what errors the compiler gives you. Try to fix them one at a time. This will usually work out, though sometimes several compiler errors may be dependent on one another, especially when you are starting out and don't have a solid grasp on proper Java syntax. To me, one of the most valuable programming skills is being able to understand and recognize the compiler messages. One that is more valuable is

    2. Do not code solely in Notepad. You may feel that being so primitive gives you a sense of knowing what's going on, but until you can write code without getting a bunch of errors the first time around, at least use Notepad++ if not an IDE (Eclipse, Netbeans) to help you organize a bit better. Notepad++ helps you identify matching curly bracers and such and color codes keywords. As for an IDE, it will often catch syntactical errors and more as you write your code, which can spoil you if you grow dependent on it.

  8. #8
    porchrat is offline Senior Member
    Join Date
    Mar 2009
    Posts
    105
    Rep Power
    0

    Default

    Quote Originally Posted by vhengIT View Post
    hi mods..am new here..this is my first time to post here..btw..can someone check the errors on my work..am very poor in java..am a 1st year college taking up IT..am using notepad and command promt..my work dosnt run coz too many errors..may someone check this out..thnxx

    import java.io.*;
    public class Help{
    public static void main(String args[]);
    BufferedReader reader=new BufferedReader(New input StreamReader(System.in));
    Float B;
    Float F;
    Float C;
    Float S;
    System.out.print("Enter the value for B");
    System.out.print("Enter the value for F");
    System.out.print("Enter the value for C");
    System.out.print("Enter the value for S");
    try{
    F=float.parseFloat(reader.readLine);
    C=float.parseFloat(reader.readLine);
    S=float.parseFloat(reader.readLine);
    F=F-(B*2);
    C=C-B;
    S=S-B;
    }
    catch(Exception e){
    System.out.print("Error");
    }
    System.out.println("The Equivalent in Fudge"+F)
    System.out.println("The Equivalent in Cookies"+C)
    System.out.println("The Equivalent in Square"+S)
    }
    }


    I think this is very easy for Pro's like you guys..and plss point out wheres my errors are..thnx a lot..
    :o :o :o :confused: :confused: :confused: :( :( :(
    OK I'm not a pro, but there are quite a few syntax errors in there that even I can see straight off. You really do need to read a little though and perhaps use an IDE that will point out these errors for you and hence help you learn, Netbeans or Eclipse are probably the best. There are plenty of good IDEs out there.

    You can't put a semicolon at the end of the main method definition like that, your method is written in a similar way to the class definition actually. Also args is of the type String[], args[] is not of the type String, args is a String[] array that in my limited experience, although it may have other uses, takes in command line or standard in inputs as values.

    Java Code:
    public static void main(String[] args){
    <method body goes here>
    }
    Another one is that you have used "New" which as mentioned above is not the same as the keyword "new" because java is case sensitive.

    Finally those last 3 println statements don't end with semicolons, you need to use semicolons to close off statements.

    I'm sure there are plenty more problems, but that is what I can see to begin with. Someone correct me if I'm wrong because as I mentioned above I am not a java "pro" and while I post to try to help others, I also post in order to learn so if there are any errors in what I have said please correct me so that I learn along with vhengIT.

    EDIT: If you are required to use a text editor such as notepad then rather go and download something more useful, if you are not allowed to use an IDE then use something like notepad++ as it has syntax highlighting and it handles indentation automatically so your code will look cleaner too.
    Last edited by porchrat; 07-11-2009 at 01:47 PM.

Similar Threads

  1. Servlet behaving badly unless method is synchronized
    By domanows in forum Java Servlet
    Replies: 0
    Last Post: 01-29-2009, 02:37 AM
  2. localization....help needed badly
    By paddala in forum Advanced Java
    Replies: 8
    Last Post: 08-27-2008, 04:29 AM
  3. need you help badly!
    By sheena06 in forum New To Java
    Replies: 4
    Last Post: 07-09-2008, 09:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •