Worksheet 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

RV UNIVERSITY

Session : 2023-24 Semester : IV


Course : B.Tech(H) Subject Code : CS2020
Branch : CSE Subject Name : Object Oriented Programming with Java
Group : A, B, C Faculty : Dr. Sathya D, Mr. Shoeb Ahmad
CO :IV Topic Construct Programs using Packages,
Interfaces for Code Reusability

Worksheet 2
1. Create an abstract class shape with abstract method to calculate area of various shapes
like rectangle, triangle, square and non-abstract method to get corresponding inputs for
area calculation.
abstract class shape
{ Var ………..
abstract void area();
void input(….)
{……………. }}
class xyz extends shape
{
void area(){………// calculate …...}………….}
public class Main { }
2. Create a class Bank and define final method to display fixed loan amount of
Rs.1500000 of personal loan and implement various methods to display various loan
schemes.
(if age is <=25 eligible for education loan of 10,00,000

if age >25 and <=45 eligible for fixed loan amount,

if age >45 and <=60 eligible for house loan of 20,00,000)

3. Design a Java package for numbers. Develop two different classes that belongs to
two package, one for to check whether the given number is palindrome or not and the
other to check whether the given number is odd or even and access these package using
one main file.
Pack1- palindrome Pack2- odd/even Pack3- third- main()-call

4. Program to print random numbers in a given range.

You might also like