Assignment 5
Assignment 5
Q.1 Write a java program to create two classes os & windows such that windows class extends
os class & overrides its performance() method using runtime polymorphism.
Q.2 Create an abstract class employee with methods getamount() which displays the amount
paid to employee. Reuse this class to calculate the amount to be paid to weekly employee
and hourly employee according to no. of hours and total hours for hourly employee and no.
of weeks and total weeks for weekly employee.
Q.4 Write a program to create your own package. Package should have more than 2 classes.
Write a class that uses he package.
Q.6 Explain Unreachable Catch Block error with the help of Java Program.
Q 8 Write a testing class TestTrace that contains the static main() method, and another
class CallEg that contains three methods. The main() method will create aCallEg object
and call its methodA().
class CallEg
{
Q.9 Create the following program. Run it and observe that the stack trace shows only those
methods that were active at the time of the exception. (In other words, the stack trace does
not show a complete history of the calls.)
class Divider
{
public void methodA()
{
System.out.println("Result: " + 12/4 );
}
try
{
dvdr.methodA( );
dvdr.methodB( );
dvdr.methodC( );
}