# Hey guys I need a bit of help with how to do this program, so can anyone help?

Updated on February 22, 2018 in
3 on February 14, 2018

A university lecturer wants you to write a program to help work out the final grade for a course. The course is made up of three parts: Assignment – Is out of 20 and counts for 10% of final grade Test – Is out of 50 and counts for 30% Exam – Is out of 100 and counts for 60% of final grade. Your program should ask them to enter the three marks (idiot proof) then display their final grade. Not sure how to do this, can anyone help?

• Liked by
on February 14, 2018

There are 2 ways you could do this. Which one depends on how exact you have to be with the % values, as none of those numbers are precisely what they account for in the final grade.

Total score: 170

Assignment = 20/170 = 11.7%

Test = 50/170 = 29.4%

Exam = 100/170 = 58.8%

So if getting an 11% with a 20/170 score is okay, then just returning the sum of the scores over the total possible score (170) would work.

HOWEVER, if you have to keep it like your example, then there are 2 parts to getting the final grade. It’s basically the same idea as above, but with an extra step.

So what you want to do is get the relative grade for each section, multiply the associated % value by that number, then add all 3 together.

EXAMPLE:

If you get a 10 in assignments, that’s 10/20, or 50%. 50% of 20% is 10%.

You get a 33 in test, that’s 33/50, or 66%. 66% of 30% is (about) 20% (19.8)%

Finally you get a 78 in exams, that’s 78/100, or 78%. 78% of 60% is (about) 47% (46.8%)

In reality you got a 121/170, or about a 71%, but according to these numbers you got a 77%

• Liked by