0% found this document useful (0 votes)
37 views

Labtask2 Oop

This document provides instructions for a lab assignment on object-oriented programming in Java. Students are asked to: 1. Create a package with a class containing constructors and methods to calculate surface areas. 2. Create a new class to access the first class, input values, create objects, and call methods to output surface areas. 3. Compile and run the program, observing the output. The assignment is assessed based on coding standards, execution, and use of techniques like method overloading and packages.

Uploaded by

cupcakerynn
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Labtask2 Oop

This document provides instructions for a lab assignment on object-oriented programming in Java. Students are asked to: 1. Create a package with a class containing constructors and methods to calculate surface areas. 2. Create a new class to access the first class, input values, create objects, and call methods to output surface areas. 3. Compile and run the program, observing the output. The assignment is assessed based on coding standards, execution, and use of techniques like method overloading and packages.

Uploaded by

cupcakerynn
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

POLYTECHNIC SULTAN MIZAN ZAINAL ABIDIN

DEPARTMENT OF INFORMATION AND COMMUNICATION TECHNOLOGY

DFP30243
OBJECT ORIENTED PROGRAMMING

TOPIC CHAPTER 3

ASSESMENT LABORATORY TASK 2

NAME NUR ARIESYA SYAFIKA BINTI ABDULLAH

REG NO 13DDT22F1176

PROGRAMME DDT3S2

INSTRUCTIONS :

1. Answer ALL the questions


2. Submit the assessment on

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:

By the end of this lab, students should be able to:

 Build objects in Java Program


 Construct String in Java Program
 Organize codes using Package.

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

Surface area of side Surface area of cube


length x width 6 x length

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

QUESTION 2 : CREATE CLASS


QUESTION 3 : OUTPUT
DFC30133 OBJECT ORIENTED PROGRAMMING

RUBRIC LABORATORY TASK 2

STANDARD WEIGHTAGE SCORE


CRITERIA Superior Excellent Good Poor
MARK (w) ((s/4) x
4 3 2 1 (s) w)
Code is well Code is organized, Code is organized, Code is 3
organized, well almost complete contain some disorganized, no
Coding Standard written comments, comments, comments, comments, no
proper indentation. inconsistent inconsistent indentation.
indentation. indentation.
Executes without Executes without Executes with some Does not execute 5
errors and the errors and the errors and the due to errors and
Execution
program produces program produces program does not the program does
correct output incorrect output produces output not produces output
5
The program uses The program uses The program uses
The program uses
Program Technique complete method incomplete method incomplete method
complete method
- method overloading overloading and overloading and overloading and
overloading and
- constructor constructor. with constructor with constructor with
constructor.
minor error. minor error. major error.

The program uses The program uses The program uses 7


The program uses
Program Technique complete user incomplete user incomplete user
complete user
- user defined package defined package defined package defined package
defined package.
with minor error. with minor error. with major error.
TOTAL (20)

You might also like