SET A
1. Define a class Employee having private members – id, name, department, salary. Define
default and parameterized constructors. Create a subclass called “Manager” with private member
bonus. Define methods accept and display in both the classes. Create n objects of the Manager
class and display the details of the manager having the maximum total salary (salary+bonus)
2. Create an abstract class Shape with methods calc_area and calc_volume. Derive three classes
Sphere(radius) , Cone(radius, height) and Cylinder(radius, height), Box(length, breadth, height)
from it. Calculate area and volume of all. (Use Method overriding).
3. Write a Java program to create a super class Vehicle having members Company and price.
Derive 2 different classes LightMotorVehicle (members – mileage) and HeavyMotorVehicle
(members – capacity-in-tons). Accept the information for n vehicles and display the information
in appropriate form. While taking data, ask the user about the type of vehicle first.
SET B
1. Define an abstract class “Staff” with members name and address. Define two sub-classes of this
class – “FullTimeStaff” (department, salary) and “PartTimeStaff” (number-of-hours, rate-perhour).
Define appropriate constructors. Create n objects which could be of either FullTimeStaff
or PartTimeStaff class by asking the user’s choice. Display details of all “FullTimeStaff” objects
and all “PartTimeStaff” objects.
2. Create an interface “CreditCardInterface” with methods : viewCreditAmount(), useCard(),
payCredit() and increaseLimit(). Create a class SilverCardCustomer (name, cardnumber (16
digits), creditAmount – initialized to 0, creditLimit - set to 50,000 ) which implements the above
interface. Inherit class GoldCardCustomer from SilverCardCustomer having the same methods
but creditLimit of 1,00,000. Create an object of each class and perform operations. Display
appropriate messages for success or failure of transactions. (Use method overriding)
i. useCard() method increases the creditAmount by a specific amount upto creditLimit
ii. payCredit() reduces the creditAmount by a specific amount.
iii. increaseLimit() increases the creditLimit for GoldCardCustomers (only 3 times, not more
0 Comments
If anyone has Doubts or suggestions please let me know