This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Program Review  RSS feed

 
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?
 
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.
 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!