Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-2009, 09:31 AM
vhengIT's Avatar
Member
 
Join Date: Jul 2009
Posts: 1
Rep Power: 0
vhengIT is on a distinguished road
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..
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-10-2009, 09:38 AM
Senior Member
 
Join Date: Feb 2009
Posts: 589
Rep Power: 1
pbrockway2 is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-10-2009, 11:22 AM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 533
Rep Power: 1
RamyaSivakanth is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-10-2009, 11:28 AM
Senior Member
 
Join Date: Apr 2009
Posts: 792
Rep Power: 1
Tolls is on a distinguished road
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:
Code:
public static void main(String args[]); // <-- semi-colon?
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-10-2009, 12:03 PM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 406
Rep Power: 3
tim is on a distinguished road
Default
Hey vhengIT. Welcome to Java Forums! Check your Personal Messages.

Tim
__________________
Eyes dwelling into the past are blind to what lies in the future.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-10-2009, 01:27 PM
Manfizy's Avatar
Senior Member
 
Join Date: Nov 2008
Location: Germany
Posts: 165
Rep Power: 2
Manfizy is on a distinguished road
Send a message via Yahoo to Manfizy
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
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-10-2009, 08:14 PM
Senior Member
 
Join Date: Sep 2008
Posts: 564
Rep Power: 2
emceenugget is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 07-11-2009, 02:29 PM
Member
 
Join Date: Mar 2009
Posts: 40
Rep Power: 0
porchrat is on a distinguished road
Default
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..
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.

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 02:47 PM.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Servlet behaving badly unless method is synchronized domanows Java Servlet 0 01-29-2009 03:37 AM
localization....help needed badly paddala Advanced Java 8 08-27-2008 05:29 AM
need you help badly! sheena06 New To Java 4 07-09-2008 10:15 AM


All times are GMT +2. The time now is 07:19 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org