Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need Java help Asap

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
-----------------------------------------------------------------------------------------------------------------------------------------------
 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its look weird, and i dont get the problem.
 
Ranch Hand
Posts: 109
2
Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 17652
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic