Beruflich Dokumente
Kultur Dokumente
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:
Pre-requisite:
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:
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).
QUESTION /SOALAN 2
Objectives:
Pre-requisite:
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
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:
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).
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).