• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Java help Asap  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your mission should you choose to accept it.
-----------------------------------------------------


Write a Java program that allows the teacher to calculate the grade for a student. The teacher will first enter the
Student ID number, first name, and last name. This will be followed by entering in the score for each of the following
categories: Assignments, Quizzes, Midterm Exam, & Final Exam
The weights for each category are as follows:

Assignments - 50%
Quizzes – 20%
Midterm – 10%
Final – 20%

Once you have the scores for each individual category, calculate a total score for the course. Then assign a letter grade
to the student based on the following grade scale:

90 – 100 = A
80 – 90 = B
70 – 80 = C
60 – 70 = D
< 60 = E

Print the results in exactly the following format:

[Last Name], [First Name]
Student ID: [Student ID]
Homework: [Homework Score]
Quizzes: [Quizzes Score]
Midterm: [Midterm Score]
Final: [Final Score]
Total Score: [Total Score] Grade: [Letter Grade]

Then ask the user if they would like to enter another student or quit. Continue the process until the user chooses to
quit.

-----------------------------------------------------------------------------------------------------------------------------------------------
This is what I have so far
-----------------------------------------------------------------------------------------------------------------------------------------------
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shawn, welcome to the Ranch!

I fixed your code tags (they need to go around the code, not next to it). But the next thing you need to do is this: tell us what the problem is. "Neither way has worked" isn't all that precise and it doesn't help anybody to pinpoint the problem. So have a look at our FAQ page TellTheDetails (<-- click on that link) and then post more information based on what you read on that page.
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need Java help Asap


ASAP! We get that so many times, that we have a page about it!
Please read https://coderanch.com/wiki/660210/Ease

...and welcome to the Ranch!
 
Greenhorn
Posts: 10
Firefox Browser Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its look weird, and i dont get the problem.
 
Ranch Hand
Posts: 107
2
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you learned objects yet? Main should only have very few lines. All of your code is in main, so you're programming in a procedural fashion.
The problem was pretty easy to solve. Place the calculations after, not before your user inputs numbers. Since you programmed everything procedurally, the order matters even more. The program won't go back to calculate dTotalScore, it's already 0. Also pay attention to the final formula, you made 4 variables which you never use (dTotalAssign, dTotalQuiz...) Replace the (dWeightAssign * dStudentAssign) with dTotalAssign and so on, otherwise there is no point to those 4 variables.
And finally, any average has to be a division. You only have an addition in yours 
 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shawn Guster wrote:

This kind of usage of Hungarian Notation in Java is quite useless. See http://www.joelonsoftware.com/articles/Wrong.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!