Skip to main content

ProwessApps

Learn · Practice · Excel

Console Applications

Student Grade Calculator

Build a console application that calculates totals, averages, grades, and pass or fail results.

Beginner60 minutes5 features

What you will build

Create a small application that accepts student marks, validates the values, calculates the result, and displays a clearly formatted report.

Learning objectives

  • Clean architecture and separation of concerns
  • Object-Oriented Design (Classes, Structs, Enums)
  • Dependency Injection for testability
  • Immutability and data safety
  • Precision math and rounding (e.g., BigDecimal/Decimal)
  • Robust console input validation and error handling
  • Using modern standard libraries (Streams/Algorithms)

Prerequisites

  • Variables and Data Types
  • Control flow (If/Else, Switch, Loops)
  • Basic Object-Oriented Concepts (Classes or Structs)
  • Understanding of Functions/Methods
  • Basic terminal/console usage

Core requirements

  1. Read student details: Accept the student name and five subject marks.
  2. Validate marks: Allow marks only from 0 to 100.
  3. Calculate result: Calculate total and average accurately.
  4. Assign grade: Assign a grade from the calculated average.
  5. Display report: Print a readable final result.

Project milestones

  1. Accept input

    Read the student name and five marks.

  2. Validate the marks

    Reject any value outside the allowed range.

  3. Calculate total and average

    Use suitable numeric types and avoid unintended integer division.

  4. Assign the grade

    Apply the project grade boundaries with conditional logic.

  5. Display and test the report

    Format the report and test normal and boundary values.

Sample interaction

Student Grade Calculator
Enter marks from 0 to 100 for five subjects.

Student name: Saad
English mark: 98
Mathematics mark: 98
Science mark: 87
Computer mark: 88
Social Studies mark: 85

--------------------------------------------------
              STUDENT GRADE REPORT
--------------------------------------------------
Student: Saad

Subject                         Mark
--------------------------------------------------
English                           98
Mathematics                       98
Science                           87
Computer                          88
Social Studies                    85
--------------------------------------------------
Total                            456 / 500
Average                        91.20
Grade                             A+
Result                          Pass
--------------------------------------------------

Testing checklist

  • Test all valid marks.
  • Test 0 and 100.
  • Test a failing mark.
  • Test a value below 0.
  • Test a value above 100.

Choose an implementation

Download Reference Solution

Free solution — sign in to download

This project's reference solution is completely free. Sign in to get instant access.

Sign in to download free