Вы находитесь на странице: 1из 8

ASSIGNMENT

MAY 2010 SEMESTER

CBOP3203
OBJECT-ORIENTED PROGRAMMING
INSTRUCTIONS:
• Answer the question below
• Marks will be deducted (or even can be given 0) if your assignment answer
contains any plagiarism or copied directly from your coursemate
• This assignment should be completed individually.

QUESTION /SOALAN 1

Objectives:

The objectives of this assignment are:

1. To implement a simple Java program


2. To implement control structures such as repetition and selection and other
appropriate techniques in Java application.

Pre-requisite:

Topic 1 – Topic 4 in your module

Your Task:
Tuliskan aturcara Java yang akan input nombor integer sehingga jumlah nombor yang
dimasukkan telah melebihi 100. (aturcara boleh ditulis secara pendekatan berstruktur)
Contoh:
55
24
6
30
(55 + 24 = 79 + 6 = 85 + 30 = 115 – oleh kerana 115 adalah melebihi 100, aturcara
akan ditamatkan)

Write a Java program that will input integers until the total entered is greater than 100.
(program may be written in the structured manner)
Example:
55
24
6
30

(55 + 24 = 79 + 6 = 85 + 30 = 115 – since 115 is greater than 100, the program ends)
Tugasan anda akan dinilai berdasarkan kriteria berikut:
Your assignment will be graded based on the following criteria:

Weight Unsatisfactory Satisfactory Good Excellent Total marks


(max)
(1 mark) (2 marks) (3 marks) (4 marks)

Delivery
1 • Completed • Completed • Completed • Completed 4
less than 70% between between between
of the 70-80% of 80-90% of 90-100% of
requirements. the the the
requirement requirement requirement
s. s. s.

Coding
Standards ½ • Poor use of • White • Good use of • Excellent 2
white space space white use of white
(indentation, makes space. space.
blank lines). program
fairly easy • Organized • Creatively
• Disorganized to read. work. organized
and messy work.
• Organized • Good use
• Poor use of work. of variables • Excellent
variables (no global use of
(many global • Good use variables, variables
variables, of variables unambiguo (no global
ambiguous (few global us naming, variables,
naming, etc). variables, etc) unambiguo
unambiguo us naming,
us naming, etc).
etc).

Runtime
½ • Does not • Executes • Executes • Executes 2
execute due without without without
to errors. errors. errors. errors
excellent
• User prompts • User • User user
are prompts prompts are prompts,
misleading or contain little understand good use of
non-existent. information, able, symbols,
poor minimum spacing in
• No testing has design. use of
been output.
symbols or
completed. • Some spacing in • Thorough
testing has output. and
been organized
completed. • Thorough testing has
testing has been
been completed
completed and output
from test
cases is
included.
Efficiency
½ • A difficult and • A logical • Solution is • Solution is 2
inefficient solution that efficient and efficient,
solution. is easy to easy to easy to
follow but it follow (i.e. understand,
is not the no and
most confusing maintain.
efficient. tricks).

Total marks: 10 marks

QUESTION /SOALAN 2

Objectives:

The objectives of this assignment are:

1. To implement a class program


2. To write Java application using objects of the class

Pre-requisite:

Topic 1 – Topic 5 in your module

Your Task:
Tuliskan satu kelas bernama Clock yang mempunyai metod-metod, atribut-atribut dan
metod-metod pembina seperti berikut:
Write a Clock class which has the following methods, attributes and constructors:

• Atribut-atribut private untuk menyimpan nilai jam (0-23), minit (0-59) dan saat
(0-59)
Private attributes to store the value of hour (0-23), minute (0-59) and second
(0-59)
• Suatu metod pembina untuk mengumpukkan nilai awal yang dispesifikasikan
oleh parameter kepada jam, minit dan saat
A constructor method to assign initial value to the hour, minute and second as
specified in the parameter
• Suatu metod pembina untuk mengumpukkan nilai awal yang dispesifikasikan
oleh parameter kepada jam dan minit. Atribut saat akan diberikan nilai 0
secara lalai
A constructor method to assign initial value to the hour and minute. Attribute
second will be assigned 0 as a default.
• Suatu metod pembina untuk mengumpukkan nilai awal yang dispesifikasikan
oleh parameter kepada jam. Atribut minit dan saat akan diberikan nilai 0
secara lalai
A constructor method to assign initial value to the hour. Attribute minute and
second will be assigned 0 as a default.
• Suatu metod bukan pembina yang mensetkan jam, minit dan saat kepada 0
A non-constructor method that will set hour, minute and minute to 0

• Suatu metod yang menokokkan saat sebanyak 1 (nota: sekiranya saat


mencecah 60, minit akan dikemaskini. Dan pada masa yang sama, apabila
minit mencecah 60, nilai jam akan dikemaskini).
A method yang will increase the second by 1 (note: if second reaches 60, the
minute will be updated. Accordingly, when minute reaches 60, the hour will be
updated)
• Metod-metod yang berlainan untuk mengumpukkan suatu nilai kepada atribut-
atribut jam, minit dan saat. Nilai-nilai yang patut diumpukkan kepada atribut-
atribut ini akan dihulurkan melalui parameter
Different methods to assign a value to the attributes hour, minute and second.
The value that need to be assigned are passed through parameter.
• Metod-metod yang berlainan untuk memulangkan nilai atribut-atribut jam, minit
dan saat.
Different methods to return the attribute values of hour, time and second.
• Suatu metod yang bernama toString yang akan memulangkan nilai-nilai atribut
jam, minit dan saat dalam bentuk rentetan aksara “hh:mm:ss”
A method which has the name toString that will returns the attributes value of
hour, minute and second in the form of string “hh:mm:ss”

Kemudian tuliskan satu kelas aplikasi yang berasingan yang mempunyai metod main()
untuk mencipta 2 objek kelas Clock. Objek-objek akan memanggil metod-metod
yang sesuai di dalam kelas Clock. Semua input perlu dibaca secara interaktif.
Then write a application class that has a main() method to create 2 objects of class
Clock. The objects will call the appropriate methods in the class Clock. All the inputs
should be accepted in an interactive manner.
Tugasan anda akan dinilai berdasarkan kriteria berikut:
Your assignment will be graded based on the following criteria:

For class Clock:

Weight Unsatisfactory Satisfactory Good Excellent Total marks


(max)
(1 mark) (2 marks) (3 marks) (4 marks)

Delivery
1 • Completed less • Completed • Completed • Completed 4
than 70% of the between between between
requirements. 70-80% of 80-90% of 90-100%
the the of the
• Not delivered requirement requirement requireme
on time s. s. nts.
• Delivered • Delivered • Delivered
on time on time on time

Coding
Standards ½ • Poor use of • White • Good use of • Excellent 2
white space space white use of
(indentation, makes space. white
blank lines). program space.
fairly easy • Organized
• Disorganized to read. work. • Creatively
and messy organized
• Organized • Good use work.
• Poor use of work. of variables
variables (no global • Excellent
(many global • Good use variables, use of
variables, of variables unambiguo variables
ambiguous (few global us naming) (no global
naming). variables, variables,
unambiguo unambigu
us naming). ous
naming).

Documentation
½ • No • Basic • Clearly • Clearly 2
documentation documentati documente and
included. on has d including effectively
been descriptions document
completed of all ed
including variables. including
descriptions description
of all • Specific s of all
variables. purpose is variables.
noted for
• Purpose is each • Specific
noted for function and purpose is
each control noted for
function. structure. each
function,
control
structure,
input
requireme
nts, and
output
results.
Runtime
½ • Does not - - • Program 2
compile due to can be
errors. compiled
succesfull
y

Efficiency
½ • A difficult and • A logical • Solution is • Solution is 2
inefficient solution that efficient and efficient,
solution. is easy to easy to easy to
follow but it follow (i.e. understan
is not the no d, and
most confusing maintain.
efficient. tricks).

Total marks: 12 marks

For the class that has the main() methods:

Weight Unsatisfactory Satisfactory Good Excellent Total marks


(max)
(1 mark) (2 marks) (3 marks) (4 marks)

Delivery
½ • Completed • Completed • Completed • Completed 2
less than 70% between between between
of the 70-80% of 80-90% of 90-100% of
requirements. the the the
requirement requirement requirement
s. s. s.

Coding
Standards ½ • Poor use of • White • Good use of • Excellent 2
white space space white use of white
(indentation, makes space. space.
blank lines). program
fairly easy • Organized • Creatively
• Disorganized to read. work. organized
and messy work.
• Organized • Good use
• Poor use of work. of variables • Excellent
variables (no global use of
(many global • Good use variables, variables
variables, of variables unambiguo (no global
ambiguous (few global us naming, variables,
naming, etc). variables, etc) unambiguo
unambiguo us naming,
us naming, etc).
etc).

Runtime
1/2 • Does not • Executes • Executes • Executes 2
execute due without without without
to errors. errors. errors. errors
excellent
• User prompts • User • User user
are prompts prompts are prompts,
misleading or contain little understand good use of
non-existent. information, able, symbols,
poor minimum spacing in
• No testing has design. use of
been output.
symbols or
completed. spacing in
• Some output. • Thorough
testing has and
been • Thorough organized
completed. testing has testing has
been been
completed completed
and output
from test
cases is
included.

Efficiency
½ • A difficult and • A logical • Solution is • Solution is 2
inefficient solution that efficient and efficient,
solution. is easy to easy to easy to
follow but it follow (i.e. understand,
is not the no and
most confusing maintain.
efficient. tricks).

Total marks: 8 marks

Total marks for Q2: 12 + 8 = 20 marks

Overall total marks= 10+20= 30 ---> 30%

-- ASSIGNMENT QUESTION ENDS HERE --

Вам также может понравиться