[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Missing post? - see this post about spam for more information.
No errors...but no answers either  XML
Forum Index » Java Programming
Author Message
Wazzat05

Newbie

Joined: 05/15/2007 13:06:13
Messages: 7
Offline

I know where the problem is. I've tested it out a few times trying to get around it, but there is something wrong with my initialization of the variable S1block1Points, or I do believe so atleast.

It's a GPA finder that I've been trying to create for personal use, I'm only partially into it and I'm getting this one annoying problem. Maybe you can help me and tell me why when I enter A into the TextField (which should give an output of 8 ) why I get an answer of 0?

This message was edited 1 time. Last update was at 05/15/2007 13:14:45

stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline

It looks like you've got two main issues. The first and most important is that you don't use == to see if two strings are equal. You'll want to use the equals() method on String to do that. So code like:

should instead be

and so on. Next, you do the work in processInputs() to calculate what S1block1Points is but then you never use that. Do you instead mean to use S1block1Points to set one of the text fields with a setNumber() call? For example, you may want to do:

as the last line in your processInputs() method.

Try that and see where you get.

This message was edited 4 times. Last update was at 05/15/2007 14:01:45


Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
Wazzat05

Newbie

Joined: 05/15/2007 13:06:13
Messages: 7
Offline

Thanks alot! That worked. I did not remember the .equals thing, since it's been awhile since I've programmed.

and so on. Next, you do the work in processInputs() to calculate what S1block1Points is but then you never use that. Do you instead mean to use S1block1Points to set one of the text fields with a setNumber() call?

And yes, with all of my messing around trying to fix it, I forgot to re-add where S1block1Points outputs. Though it was in before.

Thanks again!
Wazzat05

Newbie

Joined: 05/15/2007 13:06:13
Messages: 7
Offline

Yet another trip up in the code. When the radio buttons are selected they arn't adding the .04 to the totalGPA, and it's not displaying the weightedGPA anywhere. I'm not sure if I have my privates, and publics mixed up or what. Or maybe I'm just positioning things wrong.

The whole code:
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline

I'm not sure what is going on now - it looks good. I'd encourage you to add some debugging statements to see if things are working the way you expect. Something like:



That would help you to be sure that the code you expect is getting called.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
Wazzat05

Newbie

Joined: 05/15/2007 13:06:13
Messages: 7
Offline

I found my problem and fixed it. I now have the whole GPAfinder program working.

Though, my last and final question is:

Is there a way just to open the GUI? Not open the whole project in Eclipse.


(The problem was..
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 884
Location: Superior, CO, USA
Offline

You'll want to run the program on the command line. Your machine needs to have the Java JDK on your command line path. The instructions to do this vary based on your operating system. The Java SE 6 platform install release notes go into detail about this.

After it is installed, you can compile with

and run it with

assuming that you're in the same directory as your GPA.java file.

Take a look at the docs - they do a better job going into the details.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
 
Forum Index » Java Programming
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2012 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle