Name: Anonymous 2005-03-04 15:26
PROGRAM 6 EXCEPTION HANDLING
-------------------------------------------------------------------------
1. Define an Employee class.
a) has data members EmpNum and Pay.
b) EmpNum has format XXX-Y where each X is a digit in {0-9} and
Y is a letter in {A-M}.
c) Pay is in {1000-7000}.
d) member function SetEmpNum to validate and assign value to EmpNum.
e) member function SetPay to validate and assign value to Pay.
f) constructor to accept values for EmpNum and Pay.
g) exception InvalidEmpNum to be thrown from constructor when an
invalid value for EmpNum is received.
h) exception InvalidPay to be thrown from constructor when an
invalid value for Pay is received.
2. Write a test program to demonstrate the exceptions.
-------------------------------------------------------------------------
Submit Source Code listing your solution and results
Discuss
-------------------------------------------------------------------------
1. Define an Employee class.
a) has data members EmpNum and Pay.
b) EmpNum has format XXX-Y where each X is a digit in {0-9} and
Y is a letter in {A-M}.
c) Pay is in {1000-7000}.
d) member function SetEmpNum to validate and assign value to EmpNum.
e) member function SetPay to validate and assign value to Pay.
f) constructor to accept values for EmpNum and Pay.
g) exception InvalidEmpNum to be thrown from constructor when an
invalid value for EmpNum is received.
h) exception InvalidPay to be thrown from constructor when an
invalid value for Pay is received.
2. Write a test program to demonstrate the exceptions.
-------------------------------------------------------------------------
Submit Source Code listing your solution and results
Discuss