https://github.com/sudhanshu-ambastha/percentage-calculator
A Java program that calculates the percentage of obtained marks for different scenarios (4, 5, or 6 subjects) and handles invalid inputs gracefully.
https://github.com/sudhanshu-ambastha/percentage-calculator
educational-project educational-tool error-handling java percentage-calculator students-score
Last synced: 7 months ago
JSON representation
A Java program that calculates the percentage of obtained marks for different scenarios (4, 5, or 6 subjects) and handles invalid inputs gracefully.
- Host: GitHub
- URL: https://github.com/sudhanshu-ambastha/percentage-calculator
- Owner: Sudhanshu-Ambastha
- Created: 2024-05-19T13:57:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-19T15:21:03.000Z (over 1 year ago)
- Last Synced: 2025-01-24T23:29:39.940Z (8 months ago)
- Topics: educational-project, educational-tool, error-handling, java, percentage-calculator, students-score
- Language: Java
- Homepage: https://onecompiler.com/java/42dpb4zt6
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Percentage Calculator
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.
## Features
- 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.## Example Inputs and Outputs
### Scenario 1: 4 Core Subjects (Max Marks = 400)
Input:
```
400
85
90
80
70
```
Output:
4 core subjects percentage: 81.25%### Scenario 2: All 5 Subjects (Max Marks = 500)
Input:
```
500
85
90
80
70
75
```
Output:
All 5 subjects percentage: 80.00%### Scenario 3: All 6 Subjects (Max Marks = 600)
Input:
```
600
85
90
80
70
75
65
```
Output:
All 6 subjects percentage: 77.50%
Top 5 subjects percentage: 80.00%### Scenario 4: Error Handling
Input:
```
300
85
90
80
```
Output:
Error: None of the parameters satisfied.