You are on page 1of 4

POLYTECHNIC SULTAN MIZAN ZAINAL ABIDIN

DEPARTMENT OF INFORMATION AND COMMUNICATION TECHNOLOGY

DFP30243
OBJECT ORIENTED PROGRAMMING

TOPIC CHAPTER 3

ASSESMENT LABORATORY TASK 2

NAME MUHAMMAD ZAKWAN HAKIMI BIN ZAHARI

REG NO 13DDT21F1122

PROGRAMME DDT3-S4

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:

• Declare and define method overloading in Java program.


• Use constructor in program.
• Use Object in program.

Question

1. Build a class name as Yuran that contain the following item:


i. declare 2 data members, type of String.
ii. declare a constructor without parameter and set the 2 variables to “Yuran Pengajian Pelajar
Senior” and “PSMZA”.
iii. declare method display() to display the 2 variables that you’ve set in the constructor.
2. In the same class consider and define 2 overloading methods:
i. method to print “Yuran Pengajian”. This method should have return value (double) as
“200” and a parameter(refer to academic fee). (“Yuran Pengajian” is RM200.00) ii.
method to print “Yuran Pengajian & Asrama”. This method should have return value
(double) as “200+60” and 2 parameters(refer to academic fee and hostel fee). (“Yuran
Pengajian” is RM200.00 and “Yuran Asrama” is RM60.00)
3. Declare the second class that have the following item in main Method :
a. create an object from Yuran class and use that object to execute the display method.
b. Declare an integer variable to input choice based on the following condition:
Choice Condition Method

1 Tidak Menginap di Asrama Call Method 2 (i)

2 Menginap di Asrama Call Method 2 (ii)

c. Use the object to execute the 2 overloading methods based on condition in 3(b) and
print as output.
4. Save and compile the program.
DFC30133 OBJECT ORIENTED PROGRAMMING

RUBRIC LABORATORY TASK 2

Aspect Superior Excellent Good Poor


WEIGHTAGE SCORE
4 3 2 1
Code is organized, Code is organized,
Code is well Code is
almost complete contain one 3
Coding organized, well disorganized, no __ / 4 x 3 marks
comments, comments,
Standard written comments, comments, no = _________
inconsistent inconsistent
proper indentation. indentation.
indentation. indentation.
Executes with some Does not execute
Executes without Executes without
errors and the errors and the errors and the due to errors and 3 __ / 4 x 3 marks
Execution program does not the program does
program produces a program produces = _________
correct output incorrect output produces output not produces output

Program
Technique The program uses The program uses The program uses
- data data, object , method data, object , method data, object , 10
The program has __ / 4 x 10 marks
- object overloading and overloading and method overloading
main method only. = _________
-method constructor constructor with and constructor
overloading - correctly. minor error. with major error.
constructor
Student can answer Student cannot
Student can answer
Student can answer and delivering the answer and
and delivering the __ / 4 x 4 marks
Output and delivering the output after the delivering the 4
output before the = _________
output on time due date output after the
time
due date

TOTAL 20 _____ / 20

You might also like