You are on page 1of 7

PROBLEM STATEMENT 1: Write a Java program to create an abstract class

named Shape that contains two integers and an empty method named printArea(
). Provide three classes named Rectangle, Triangle and Circle such that each one
of the classes extends the class Shape. Each one of the classes contains only the
method printArea( ) that prints the area of the given shape
SOURCE CODE:

TESTCASE:
PROBLEM STATEMENT 2: Create three classes Student, Exam and Result. The
Student class has members such as rollno, name. Create a class Exam by
inheriting the Student class. The Exam class adds data members representing
the marks scored in six subjects. Derive the Result from the exam class and has
its own members such as total marks. Write a java program to model this
relationship.
SOURCE CODE:

TESTCASE:
PROBLEM STATEMENT 3 : Write a Java program to implement Multi-level
Inheritance.
SOURCE CODE:

TESTCASE:
PROBLEM STATEMENT 4: Write a Java program to implement Hierarchical
Inheritance.
SOURCE CODE:

TESTCASE:
PROBLEM STATEMENT 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.
TESTCASE:

You might also like