Results 1 to 13 of 13
Thread: HELP! Urgent.
- 11-15-2011, 08:10 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
HELP! Urgent.
Hi guys, I get and error saying " 'else' without 'if " in this statement:
if (angled >0 && 180<angled) {
System.out.printf("\n angle D = %f",+ myQuad.angled());
else
System.out.printf("This does not make the total of 360 degrees");
}
Can anyone help me with this? I have to hand this in tomorrow.
Thanks
- 11-15-2011, 08:14 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,401
- Blog Entries
- 7
- Rep Power
- 17
Re: HELP! Urgent.
Check the placement of your curly brackets.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 11-15-2011, 08:14 PM #3
Member
- Join Date
- Nov 2011
- Location
- Arizona
- Posts
- 10
- Rep Power
- 0
Re: HELP! Urgent.
you else is embeded in the if statement
if-else needs to be in this format
if (1 == 1){
//do something
}
else
{
//do nothing
}
- 11-15-2011, 08:16 PM #4
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: HELP! Urgent.
Got that bit working. just a minute ago. thx guys
- 11-15-2011, 08:16 PM #5
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: HELP! Urgent.
but it won't find angle D when i input angle a,b,c..
- 11-15-2011, 08:19 PM #6
Member
- Join Date
- Nov 2011
- Posts
- 14
- Rep Power
- 0
Re: HELP! Urgent.
Hi sorry for posting something irellevant, but just wanted to ask, i have just posted a post and says should be up after mod checks... how long does this take (sorry i am new to this)
Thanks
- 11-15-2011, 08:20 PM #7
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: HELP! Urgent.
thanks. I'm sure it was something to do with the curly brackets
- 11-15-2011, 08:21 PM #8
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
- 11-15-2011, 08:24 PM #9
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,401
- Blog Entries
- 7
- Rep Power
- 17
- 11-15-2011, 08:30 PM #10
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: HELP! Urgent.
Thx. I get this error which is the same code i posted at the top. It says:
angle D = Exception in thread "main" java.util.IllegalFormatConversionExceptio
: f != java.lang.Integer
at java.util.Formatter$FormatSpecifier.failConversion (Unknown Source)
at java.util.Formatter$FormatSpecifier.printFloat(Unk nown Source)
at java.util.Formatter$FormatSpecifier.print(Unknown Source)
I changed the print method numerous times and still cannot get passed this.
Do you know the exact problem to this??
- 11-15-2011, 09:04 PM #11
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
Re: HELP! Urgent.
Check the + operation in the code you originally posted. And make sure it is the right format specifier for whatever argument you use in the code you are currently using. (%d for ints and %f for floating point arguments.)I changed the print method numerous times and still cannot get passed this.
Do you know the exact problem to this?Last edited by pbrockway2; 11-15-2011 at 09:07 PM.
- 11-15-2011, 09:11 PM #12
Member
- Join Date
- Nov 2011
- Posts
- 12
- Rep Power
- 0
Re: HELP! Urgent.
Yeah, I looked up on the internet and used %d and it worked. Thanks boss :)
- 11-15-2011, 09:16 PM #13
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
Re: HELP! Urgent.
You're welcome.
The API docs are too much to try and remember, but well worth bookmarking as a place to go to when haveing trouble getting printf to print the way you want: Formattable (Java Platform SE 6)
Similar Threads
-
urgent help please
By marksey07 in forum New To JavaReplies: 4Last Post: 03-08-2011, 03:35 AM -
Urgent HELP!
By Mp4Player in forum New To JavaReplies: 2Last Post: 01-04-2011, 08:34 PM -
[URGENT]SHA Encryption System...need urgent helps
By java_idiot in forum New To JavaReplies: 6Last Post: 05-02-2010, 10:04 AM -
Please Help me urgent help please
By ravjot28 in forum New To JavaReplies: 2Last Post: 01-30-2010, 01:59 PM -
Urgent!!!
By winnie99 in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 12-18-2009, 03:17 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks