Java Problemsheet 2-1

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

Bhagwan Mahavir College of Computer Application

S.Y.B.C.A. SEM - IV
Paper - 1020201403 Programming in Core Java
PROBLEM SHEET – II

1. Create a class called “stud” which contains instance variables rollno, name of the
student, class. Store “stud” class in package name p1. Extend class “result” from
“stud” which contains instance variables marked in Unix, marks in Java, marks
in OS. Store class results in package name p2, which resides in package name
p1. Write a java code to run a main method and display the content of the
student in the following format.

BCA College
Roll No Name Class Java ASP PHP Total 1 SYBCA C 85 80 90 255
--------------------------------------------------------------------------------------------------------
2. Create a package called “Salary”. Under this package create 2 classes say
“income” and “expense”. The income class contains „salary, interest and rent‟
while expense contains „food, clothing and education‟ expenses. Create a class
“Budget” which uses these classes and counts the savings of a family. The Budget
class is in the “MyBudget” package.
3. Define a package called stores with member variable item no, name, quantity and
cost in a class item. Create a class sales from item with member variable qty. Store
inside a package purchase.
Do the following :
=> Stock available
=> Total
=> View all
4. Develop an applet that draws a circle. The dimension of the applet should be 500 x
300 pixels. The circle should be centered in the applet and have a radius of 100
pixels. Display your name centered in a circle. (UsingdrawOval() Method.
5. Draw ten red circles in a vertical column in the center of the applet.
6. Built an applet that displays a horizontal Rectangle in the center. Let the rectangle
with color from left to right
7. Create an applet which displays your name within a triangle inside a circle.
8. Write an applet to load as images.
9. Write an applet program to display Face.
10.Write an applet that describes all graphic class methods.
11.Write an applet to display Star.
12.Write a program in java to demonstrate implementation of multiple inheritances
using interfaces.
13.Describe an abstract class called Shape which has three subclasses say Triangle,
Rectangle, and Circle. Define one method area() in the abstract class and override
this area() in these three subclasses to calculate for a specific object. i.e area() of
Triangle subclass should calculate area of triangle etc. Same for Rectangle and
Circle.
14.WAP to create an interface Shape which defines two methods area() and
circumference .Create two classes Rectangle and Circle which implements the
interface Shape.
15.WAP which defines an interface payable with a method getPay(). Create a class
called invoice with member variables (part no, partname, quantity,and cost per
item). Create an object away from invoice and invoice inherits the interface
payable. Do the Following: insert, search,view all, exit.

Note: Index must be proper with Date, Definition and Page no.
All programs should have a proper output.
Each Program should be on a new page.

Submission Date
30th March 2024

You might also like