Results 1 to 5 of 5
  1. #1
    javanewbie82 is offline Member
    Join Date
    Oct 2016
    Posts
    13
    Rep Power
    0

    Default problems with calculating a students grade

    Hi so I have a program which should calculate a students grade with tests that have different weights. My issue is that it isn't calculating correctly.

    public void setFinalGrade()
    {

    if (gradeNumber <= 100)
    {
    gradeNumber = (((quizScore1 + quizScore2 + quizScore3) * .25) + (midtermScore * .35) + (finalScore * .4));
    }

    }
    Last edited by javanewbie82; 11-21-2016 at 10:07 PM.

  2. #2
    javanewbie82 is offline Member
    Join Date
    Oct 2016
    Posts
    13
    Rep Power
    0

    Default Re: problems with calculating a students grade

    Quiz one = 9
    Quiz two = 7
    Quiz three = 9
    Midterm score = 40
    Final exam score = 50
    Student's grade = 40.25
    Letter grade = F

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: problems with calculating a students grade

    because of integer division
    Where is there any division? I don't see it in the posted code.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    javanewbie82 is offline Member
    Join Date
    Oct 2016
    Posts
    13
    Rep Power
    0

    Default Re: problems with calculating a students grade

    Oh you're right, I thought maybe multiplying the ints by a double would result in cutting it off. I am unsure then why it is resulting in the erroneous score. I think I might have figured out part of the problem...I probably need a maximum score?

  5. #5
    javanewbie82 is offline Member
    Join Date
    Oct 2016
    Posts
    13
    Rep Power
    0

    Default Re: problems with calculating a students grade

    Oh I feel dumb I misread the point values. How do I delete posts on here XD

Similar Threads

  1. Replies: 6
    Last Post: 09-15-2014, 02:01 AM
  2. Replies: 2
    Last Post: 04-06-2013, 01:43 AM
  3. Calculating Area of Annulus - arrays problems!!!
    By hadenkl in forum New To Java
    Replies: 7
    Last Post: 05-15-2011, 11:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •