0% found this document useful (0 votes)
3 views3 pages

103 - Java Programming - DF-IV

The document outlines a series of Java programming exercises for MCA Semester I students, focusing on class creation, method overriding, and subclassing. It includes tasks for implementing various class hierarchies such as Animal, Vehicle, Shape, Employee, and BankAccount, with specific functionalities for each subclass. The exercises aim to enhance understanding of object-oriented programming concepts in Java.

Uploaded by

surajpawar0229
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)
3 views3 pages

103 - Java Programming - DF-IV

The document outlines a series of Java programming exercises for MCA Semester I students, focusing on class creation, method overriding, and subclassing. It includes tasks for implementing various class hierarchies such as Animal, Vehicle, Shape, Employee, and BankAccount, with specific functionalities for each subclass. The exercises aim to enhance understanding of object-oriented programming concepts in Java.

Uploaded by

surajpawar0229
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

JAVA PROGRAMMING

DISCUSSION FORUM - IV

MCA SEM - I (Dr. Mahadev K. Patil)


DISCUSSION FORUM
JAVA PROGRAMMING

1. Write a Java program to create a class called Animal with a method called makeSound(). Create a subclass called Cat
that overrides the makeSound() method to bark.

2. Write a Java program to create a class called Vehicle with a method called drive(). Create a subclass called Car that
overrides the drive() method to print "Repairing a car".

3. Write a Java program to create a class called Shape with a method called getArea(). Create a subclass called Rectangle
that overrides the getArea() method to calculate the area of a rectangle.

4. Write a Java program to create a class called Employee with methods called work() and getSalary(). Create a subclass
called HRManager that overrides the work() method and adds a new method called addEmployee().

5. Write a Java program to create a class known as "BankAccount" with methods called deposit() and withdraw(). Create a
subclass called SavingsAccount that overrides the withdraw() method to prevent withdrawals if the account balance falls
below one hundred.

MCA SEM - I (Dr. Mahadev K. Patil)


DISCUSSION FORUM
JAVA PROGRAMMING

6. Write a Java program to create a class called Animal with a method named move(). Create a subclass called Cheetah
that overrides the move() method to run.

7. Write a Java program to create a class known as Person with methods called getFirstName() and getLastName(). Create
a subclass called Employee that adds a new method named getEmployeeId() and overrides the getLastName() method to
include the employee's job title.

8. Write a Java program to create a class called Shape with methods called getPerimeter() and getArea(). Create a subclass
called Circle that overrides the getPerimeter() and getArea() methods to calculate the area and perimeter of a circle.

9. Write a Java program to create a vehicle class hierarchy. The base class should be Vehicle, with subclasses Truck, Car and
Motorcycle. Each subclass should have properties such as make, model, year, and fuel type. Implement methods for
calculating fuel efficiency, distance traveled, and maximum speed.

10. Write a Java program that creates a class hierarchy for employees of a company. The base class should be Employee,
with subclasses Manager, Developer, and Programmer. Each subclass should have properties such as name, address, salary,
and job title. Implement methods for calculating bonuses, generating performance reports, and managing projects.

MCA SEM - I (Dr. Mahadev K. Patil)


DISCUSSION FORUM

You might also like