Labtask2 Oop
Labtask2 Oop
DFP30243
OBJECT ORIENTED PROGRAMMING
TOPIC CHAPTER 3
REG NO 13DDT22F1176
PROGRAMME DDT3S2
INSTRUCTIONS :
MARKING SCHEME
CLO 1 PLO 3 / 20
TOTAL / 20
THE ENTIRE QUESTION IS BASED ON JTMK’S QUESTION BANK APPROVED BY PROGRAMME LEADER.
SIGNATURE IS NOT REQUIRED.
CHAPTER 3 : CLASSES AND OBJECTS [CLO 1][PLO 3]
Learning outcomes:
Question
1. Build a program to create a package with appropriate name . The package should contains a
class (set appropriate name) with following rules:
i. Define a default constructor that print “SURFACE AREA FOR SIDE AND CUBE”.
ii. Define TWO(2) overload methods to calculate the surface area for side with TWO(2)
parameters and calculate the surface of cube with ONE(1) parameter . These methods
should have return value (double). Refer formula in Table 1.
iii. Save this program as classname.java(based on own class name).
Table 1: Formula
2. Build a new class with appropriate name and define default constructor that print “ACCESSING
CLASS FROM PACKAGE”. Import package in Question 1. Then consider with the following rules
in main Method :
i. Declare TWO(2) double variables (length and width).
ii. Input 2 floating point number as length and width values.
iii. Create TWO(2) objects for class in package and the second class.
iv. Call TWO(2) overloaded method in package and don’t forget to set the argument when you
called the method (parameter). Arrange the appropriate output.
v. Save this program as classname.java(based on own class name).
3. Compile, execute and observe output.
QUESTION 1 : CREATE PACKAGE