Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program Review

 
Canh Ly
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I had a question before on a code that I had problem with. Heres my finished project, I only have one small problem still, Ive tested every part and every part compiles and runs up until the last few lines and I cant seem to figure out why. The errors I get are below. The process Im trying to do is use a string to print out the else if statements in my code. I attached my full code below and was wondering if I could get a quick check just to make sure the way Im trying to call my final calculation is correct. It would be much appreciated. This is indeed a homework assignment, but Its already past the due date so I just want to find out the answer for myself thanks!









 
Canh Ly
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also quick note, in line 111 I just realized It wasn't finished. At the moment it is in a public static double, but should I use a "public static double calculateScore(double assigns, double inclass, double labs, double midterm1, double midterm2, double finalexam){" instead to pass the variables for calculation, or have it a public static double?
 
Tina Smith
Ranch Hand
Posts: 208
9
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't define functions inside of other functions/methods. Take a look at line 124; if you want the code to compile you should move the "inner" function you're declaring there to stand as a function by itself.
 
Greg Ferguson
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Starting with line 129, it looks like you have redundant code. If you're going to assign a value to grade, you should use it like this:

otherwise the grade variable is not necessary.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic