Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

ASSIGNMENT

SEPT 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 and must be
submitted online through myVLE
 Deadline for the submision is stated in myVLE

QUESTION /SOALAN 1

Consider the following Student class specification:

public Student() //CONSTRUCTOR


Initialized the attributes

public String name ()


This Student’s name

public String address()


This Student’s address

public String matric ()


This Student’s matric number

public int creditHours ()


Number of credit hours this Student enrolled in

public int fees ()


This Student’s fees for the semester

public int feesPaid ()


Amount this Student has paid so far for this semester

public void changeName(String newName)


Change the name of this Student

public void changeAddress (String newAddress)


Change the address of this Student

public void changeMatric(String newMatric)


Change the matric of this Student

public void payFees(int amout)


Pay specified amount of fees

public void registerCourses(Course course)


Register course(s) for this Student

public void displayCourses(Course course)


Display courses registered by this Student
The methods registerCourses and displayCourses in the class Student
use another class - class Course. The specification for the class Course is
given below:

public void registerCourses (String courses[], int numberOfCourses)


Register the courses to this Student

public void displayCourses()


Display courses registered by this Student

i. Write the complete program for the classes Student and Course
above (Assume that the fees are $100 per credit hour, student can
only register a maximum of 5 courses and minimum of 1 course per
semester, all the attributes should be declared as private).
ii. Test the above class program in a new class which has the
main()method (your main() program should be interactive)

[Total marks: 30 Marks]


Pertimbangkan spesifikasi kelas Student berikut:

public Student() //METOD PEMBINA


memberikan nilai awal untuk atribut

public String name ()


Nama Student ini

public String address()


Alamat Student ini

public String matric ()


No matrik Student ini

public int creditHours ()


Bilangan jam kredit yang didaftar oleh Student ini

public int fees ()


Yuran semester untuk Student ini

public int feesPaid ()


Amaun yang telah dibayar setakat ini untuk semester

public void changeName(String newName)


Tukar nama untuk Student ini

public void changeAddress (String newAddress)


Tukar alamat untuk Student ini

public void changeMatric(String newMatric)


Tukar matrik untuk pelajar ini

public void payFees(int amout)


Bayar sejumlah amaun yuran
public void registerCourses(Course course)
Daftar kursus (-kursus) untuk Student ini

public void displayCourses(Course course)


Paparkan kursus(-kursus) yang didaftar oleh Student ini

Metod registerCourses dan displayCourses di dalam kelas Student


menggunakan kelas yang lain - kelas Course. Spesifikasi bagi kelas Course
diberikan di bawah:

public void registerCourses (String courses[], int numberOfCourses)


Daftar kursus untuk Student ini

public void displayCourses()


Paparkan kursus yang didaftar oleh Student ini

i. Tuliskan aturcara lengkap bagi kelas-kelas Student dan Course


(Andaikan yuran adalah $100 per jam kredit, pelajar hanya boleh
mendaftar maksimum 5 kursus dan minimum 1 kursus, semua atribut perlu
didaftar sebagai private)
ii. Uji aturcara kelas anda di dalam kelas baru yang mempunyai metod
main() (aturcara metod main() anda haruslah interaktif)

Tugasan anda akan dinilai berdasarkan kriteria berikut:


Your assignment will be graded based on the following criteria:
Weight Unsatisfactory Satisfactory Good Excellent Total marks
(1 mark) (2 marks) (3 marks) (4 marks) (max)

Delivery 3  Completed less  Completed  Completed  Completed 12


than 70% of between between 80- between
the 70-80% of 90% of the 90-100%
requirements. the requirement of the
 Not delivered requirement s. requireme
on time s.  Delivered on nts.
 Delivered time  Delivered
on time on time

Coding 1  Poor use of  White  Good use of  Excellent 4


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

Documentation 1  No  Basic  Clearly  Clearly 4


documentation documentati documented and
included. on has including effectively
been descriptions document
completed of all ed
including variables. including
descriptions  Specific description
of all purpose is s of all
variables. noted for variables.
 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 1.5  Does not  Executes  Executes  Executes 6


execute due to without without without
errors. errors. errors. errors
 User prompts  User  User excellent
are misleading prompts prompts are user
or non-existent. contain little understanda prompts,
 No testing has information, ble, good use
been poor minimum of
completed. design. use of symbols,
 Some symbols or spacing in
testing has spacing in output.
been output.  Thorough
completed.  Thorough and
testing has organized
been testing has
completed been
completed
and output
from test
cases is
included.

Efficiency 1  A difficult and  A logical  Solution is  Solution is 4


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 confusing d, and
most tricks). maintain.
efficient.

Overall total marks= 30 ---> 30%

-- ASSIGNMENT QUESTION ENDS HERE --

You might also like