Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Double!!!!!!

 
joe kane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, I cant seem to get this working I know its something small,


Thanks loads in advance joe Kane..
 
Timmy Marks
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some of the first things that I see is that your methods are not static at the bottom of your code, you are passing 3 values in your call to methodtotals/totals (which expects none), you are assigning the results of this method to a variable (the method is void), your methods are expecting int values instead of doubles, and the method is called totals and you are calling it as methodtotals.
The very first thing that I see when reading the code is that you do basically the same thing three times and you have the code in there three times. I would like to recommend the book Refactoring: Improving the Design of Existing Code which is an excellent book detailing how to get rid of such redunduncies.
If you solve the above problems and it still doesn't work, I will look more into it. Hope this helps
 
joe kane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Pls excuse the code,
Here is the code:

Thank joe Kane
 
Timmy Marks
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
notice that here:
choice1 = JOptionPane.showInputDialog("Enter Grade 1");

you are initializing choice1, but here:
while (choice == null){

you are testing choice
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic