0% found this document useful (0 votes)
2 views

assingment-6(user_exception)

Uploaded by

myselfghoshayan
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)
2 views

assingment-6(user_exception)

Uploaded by

myselfghoshayan
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

ASSINGMENT-6

1. Create an employee class with data member like emp_id, name, designation, year_of_join, year_of_birth,
basic_salary. This class contains a pension compute method with prototype int penson_compute() such that it
should compute the pension of the particular employee object (those who are retiring in 2020) that has
invoked the method. The criteria for pension computation is mentioned below.
• To be eligible for the pension,
a. The employee must have completed at least 10 years of service (including the retiring year)
b. Must have attended 60 years of age in 2020.
• If any one of these conditions i.e either a or b fails then the employee is not eligible for pension and the
particular cause of such failure will be notified through proper user defined exception object. Hence two user
defined exception classes should be created for handling a and b condition and they will be thrown under
proper circumstances. Note that for computing the year of experience/service and age, the year_of_join and
year_of_birth should be subtracted from 2020. For other valid cases the criteria for pension computation will
be-
➢ For designation= ‘faculty’,
• Pension=basic_salary+20000*(2020-Year_of_join)+10000(2020-Year_of_birth)
➢ For designation= ‘Technical_Asst’,
• Pension=basic_salary+10000*(2020-Year_of_join)+5000(2020-Year_of_birth)
➢ For designation= ‘Staff’,
• Pension=basic_salary+5000*(2020-Year_of_join)+2000(2020-Year_of_birth)
ASSINGMENT-6 contd ..
Now based on these information carry out the following operations
1. User supplies emp_id, such that the pension of that employee will be
displayed.
2. User supplies the designation, such that the pension of all the employees with
that designation will be displayed. (omit exception cases)
3. User supplies a particular pension amount such that all the employee
receiving pension above that amount will be displayed. (omit exception cases)
4. User supplies number of years in service i.e experience, such that the pension
amount of all those employees who served more than that period will be
computed and displayed (omit exception cases)

You might also like