Picking best possible number combination.

Hello, been writing a program for my university, on how to calculate best semester grades, in a form of a table, where they type in their info of :

-how many subjects taken?
-grade of each subject he has got before exam.
-how much each grade weights.
-how much exam weights.
-exam grades.

Ill give you an example. A student has math class, so far he has written 2 tests, and had 2 verbal tests. For his 2 written tests he has gotten 10, and 7. These grades are both worth 12.5% each. For his verbal tests, he has received 5 and 8, these both are 12.5% each as well. So he awaits his exam , witch is 50% worth. So, before his exam, his best possible result would of been 5 as it stands for 50%, and if he gets 10 from exam, he will have a solid 10.

What i have done so far, i have calculated everything before exam, and after exam, and it shows how much he has got over all. Since more than half of my university students are slackers, and they usually just want to make it to 5 after whole semester, witch is grade they need to get to pass the course.

This is the point where i need help, since i have been programming only for half a year over all so far, and my lack of language is in deep abyss, and I'm trying to climb my way out of it :)

I want to calculate the best possible grade, that a student needs from exam to get, to pass the course and get final mark of 5 at least. So for example he has 4 from his all grades pre exam, and he needs a minimum of 6 from exam to be able to pass the course.

I know, that I need to calculate all possible grades that are needed for him to pass the course, and then to simply make min function to show witch is the lowest grade he needs to pass the course.

Also, if a student fails his subject, he cant retake his exam for 1 time, or he can try to improve his pre exam grades. How can i calculate all the possible variables of all these subjects, so I'd like to be able to show them, 'ok, you failed your subject, but if you get 8 from 1st test, and 6 from exam, you'll be able to pass it with a final mark of 5.' And if I may ask kindly, please explain on what you do, where what goes, and math behind it.

May you assist me kind people of community? ^_^ Thank you very much.

PS. My 1st post here, and I'm looking forward to become a programmer, sorry for any typo that i have made <3
Last edited on
Do you just want direction or do you have any real problem in your code?

What does your program look like?
Topic archived. No new replies allowed.