#C11373. Final Grade Calculator
Final Grade Calculator
Final Grade Calculator
You are given the scores for assignments, projects, and exams. Your task is to compute the final grade based on the following weighted average:
\( \text{final\_grade} = 0.4 \times \text{avg(assignments)} + 0.3 \times \text{avg(projects)} + 0.3 \times \text{avg(exams)} \)
Then, assign a letter grade according to:
- Grade A if \( \text{final\_grade} \geq 90 \)
- Grade B if \( 80 \leq \text{final\_grade} < 90 \)
- Grade C if \( 70 \leq \text{final\_grade} < 80 \)
- Grade D if \( 60 \leq \text{final\_grade} < 70 \)
- Grade F if \( \text{final\_grade} < 60 \)
The input is provided via standard input and the output should be printed to standard output.
inputFormat
The first line contains three space-separated integers \( n_a \), \( n_p \), and \( n_e \) representing the number of assignment scores, project scores, and exam scores respectively. The second line contains \( n_a \) space-separated integers representing the assignment scores. The third line contains \( n_p \) space-separated integers representing the project scores. The fourth line contains \( n_e \) space-separated integers representing the exam scores.
outputFormat
Output a single letter representing the final grade ('A', 'B', 'C', 'D', or 'F').
## sample4 2 2
95 92 88 96
90 91
93 94
A