| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 13:13:21
|
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
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 13:57:32
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
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 |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 14:05:29
|
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!
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 17:08:54
|
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:
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 19:48:25
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
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 |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 22:51:58
|
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..
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 05/15/2007 23:28:54
|
stdunbar
Newbie
![[Avatar]](/images/avatar/a87ff679a2f3e71d9181a67b7542122c.png)
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 |
|
|
 |
|
|
|
|