Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Exercise01

Question 1 (100%) Write a program that calculates the student's final grade in a particular
course. There are five exercises in the course, the weight of each exercise is 5% of the grade, and
a final test. Student have to submit at least three exercises. If the student has submitted three
exercises, then the final test weight is 85% of the grade. If the student has submitted four
exercises, then the final test weight is 80% of the grade. If the student has submitted five
exercises, then the final test weight is 75% of the grade. If the student has submitted less than
three exercises its final score would be 0 regardless of test scores. Your program will ask the user
to enter the marks of exercises. Assignments will be between 0 and 100. If the student does not
submit the exercise will feed number -1. At the end of the entering exercises grades, the user will
be asked to enter final test score (a number between 0 and 100). Once this is complete the user
will be presented the final grade in the course. Here are two examples of how the program. The
numbers in bold indicate user input: Example 1: Welcome to grades calculator.
Enter grade of ex1: 100
Enter grade of ex2: 90
Enter grade of ex3: -1
Enter grade of ex4: 100
Enter grade of ex5: 80
Enter grade of exam: 70
The final grade is: 74.5
Note that the student did not do exercise 3. Therefore his final grade is computed as follow:
finalGrade = 100*0.05 + 90*0.05 + 100*0.05 + 80*0.05 + 70*0.8 = 74.5

Example2:
Welcome to grades calculator.
Enter grade of ex1: 100
Enter grade of ex2: -1
Enter grade of ex3: -1
Enter grade of ex4: 100
Enter grade of ex5: -1
Enter grade of exam: 90
The final grade is: 0
Please note that the student has submitted only two exercises and so he failed the course and the
final grade is 0.

Comments
- You can assume the user input will be valid, which means exercises scores will inevitably be
numbers between 0 and 100 and no other number. You can assume that test scores will always be
between 0 and 100 and no other number. There is no need to check it.
- Use the constants and variables where possible.
- Write a well documented the program.
Submission Guidelines
1. Write the program in class named Grades.java
2. The classes are bagged in a zip or rar file single, called Ex1.zip or Ex1.rar.

You might also like