Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views1 page

Assignment 12 - Exception Handling

The document outlines an assignment focused on exception handling in programming. It includes tasks such as creating user-defined exceptions for various scenarios, including marks out of bounds, low account balance, ride distance, voting age validation, password length, and age restrictions for a roller coaster ride. Each task requires the implementation of specific classes and methods to handle exceptions appropriately.

Uploaded by

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

Assignment 12 - Exception Handling

The document outlines an assignment focused on exception handling in programming. It includes tasks such as creating user-defined exceptions for various scenarios, including marks out of bounds, low account balance, ride distance, voting age validation, password length, and age restrictions for a roller coaster ride. Each task requires the implementation of specific classes and methods to handle exceptions appropriately.

Uploaded by

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

Assignment 12: Exception Handling

1. Write a program to find the exception Marks Out Of Bounds. Create a class student.If the
mark is greater than 100,it must generate the user-defined exception called Mark Out Of
Bound Exception and throw it.
2. Write a class account with acc_no, name and balance. Initialize values through
parameterized constructor. If balance is in lower than 5000 generate user-defined
exception : “Low balance”.
3. Create a class OlaRide(ride_id, source, destination, distance function bookRide should
handle user defined exception if distance is less than 5km and appropriate msg is displayed.
4. Create user defined exception Age exception to throw exception in voter class by creating a
method void validate(int age) which accepts person age greater than 18 is validate to vote
else throw age exception
5. Create a class "user" storing the information like username and password.Give appropriate
constructors and functions. If password length is less than eight characters ,user defined
exception should thrown and appropriate message should be shown
6. Create user defined class RollerCoaster and throw the exception as “AgeException” to check
the valid age for a ride.Age greater than 12 is allowed for the ride else print a proper
message “you should come after – years”).Age greater than 60 is not allowed for the ride
else print a msg that “you should have come before – years”

Page 1 of 1

You might also like