0% found this document useful (0 votes)
4 views2 pages

JAVA TASK (Exception Handling)

The document outlines three tasks involving exception handling in software applications: a basic calculator, a banking application, and a student management system. Each task includes specific operations and defines various exceptions to handle invalid inputs, insufficient funds, and other errors. The requirements emphasize the importance of robust error management in user interactions with the applications.

Uploaded by

Rajprakash R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

JAVA TASK (Exception Handling)

The document outlines three tasks involving exception handling in software applications: a basic calculator, a banking application, and a student management system. Each task includes specific operations and defines various exceptions to handle invalid inputs, insufficient funds, and other errors. The requirements emphasize the importance of robust error management in user interactions with the applications.

Uploaded by

Rajprakash R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

EXCEPTION HANDLING

Task 1: Create a Basic Calculator

Create a basic calculator that can perform addition, subtraction, multiplication, and division.
Implement exception handling to manage invalid inputs and division by zero.

Exception Handling Requirements:

1. InvalidInputException: Throw this exception for invalid input (e.g., non-numeric input).

2. ArithmeticException: Handle division by zero.

Task 2: Build a Simple Banking Application

Create a banking application that performs the following operations:

1. Create Account: Create new accounts with a unique account number and an initial balance.

2. Deposit: Allow deposits to accounts, ensuring the amount is positive.

3. Withdraw: Allow withdrawals from accounts, ensuring the amount is positive and does not
exceed the current balance.

4. Transfer: Allow transferring money between two accounts, ensuring sufficient balance in the
source account.

5. Account Details: Retrieve account details, including the balance.

Exception Handling Requirements:

1. InvalidAmountException: Throw this exception for invalid deposit or withdrawal amounts.

2. InsufficientFundsException: Throw this exception for withdrawal or transfer attempts that


exceed the account balance.

3. AccountNotFoundException: Throw this exception when an attempt is made to access a


non-existent account.

4. TransferException: Throw this exception for any errors during the transfer process.
Task 3: Develop a Student Management System

Create a Student Management System that performs the following operations:

1. Add Student: Add new students with details like name, age, and grade.

2. Remove Student: Remove a student by their unique ID.

3. Update Student Details: Update the details of an existing student.

4. Search Student by Name: Search for a student by their name and retrieve their details.

5. List All Students: List all students with their details.

Exception Handling Requirements:

1. InvalidAgeException: Throw this exception if the age provided is not within a valid range
(e.g., 5-100).

2. StudentNotFoundException: Throw this exception when trying to access a non-existent


student by ID.

3. InvalidGradeException: Throw this exception if the grade provided is invalid (e.g., not in A-F
range).

You might also like