This Java program calculates the percentage of obtained marks based on different scenarios: 4 core subjects, 5 subjects, 6 subjects, and the top 5 subjects in a 6-subject scenario. The user provides the maximum marks (either 400, 500, or 600) and the obtained marks for each subject. The program then calculates and displays the appropriate percentages.
- Calculates the percentage for 4 core subjects if the maximum marks are 400.
- Calculates the percentage for all 5 subjects if the maximum marks are 500.
- Calculates the percentage for all 6 subjects and the top 5 subjects if the maximum marks are 600.
- Handles invalid input and displays appropriate error messages.
Input:
400
85
90
80
70
Output: 4 core subjects percentage: 81.25%
Input:
500
85
90
80
70
75
Output: All 5 subjects percentage: 80.00%
Input:
600
85
90
80
70
75
65
Output: All 6 subjects percentage: 77.50% Top 5 subjects percentage: 80.00%
Input:
300
85
90
80
Output: Error: None of the parameters satisfied.