CS200 - Assignment 2
CS200 - Assignment 2
Assignment 2
Guidelines
General:
1. Total Marks: 100
2. Weightage: 20%
3. This is a group assignment to be submitted on 10 April 2021
a. Group of 4 students
b. CR of each cohort to send list of groups to respective lectures by 24 Mar 2021
4. You are required to develop all programs using Java programming language.
Submission:
1. Save your project in an OneDrive folder.
a. Name your folder with your cohort and group number.
i. E.g. DCY1A Group 2
ii. E.g. DDM1C Group 7
b. In each folder, submit your full project (not only .java file) & class diagram in word/pdf
file
2. Copy the Shared link of this folder (public)
3. Group Leader go to this website:
https://forms.office.com/Pages/ResponsePage.aspx?id=pI5W-
UqaUkyTmIVxH9n70qAn8CTLimVFoFM6J-
eXu3BURVpBTElKRzM4M1lWWktTQk5TNko4VjVFSy4u
You need to use your PolyMail to sign in. Personal emails will not be allowed access.
4. Fill in this form as required.
5. No Email submissions will be accepted.
1
CS200 – Assignment 2
Task A: Class Creation
Description
You are requested to draw the class diagrams and show the relationship between them.
8. Second design the the Book class. Assume that a book is written by one (and exactly
one) author.
9. The Book class contains the following members:
10. Four private member variables: title (String), author (an instance of the Author class,
assuming that each book has exactly one author), price (double), and qty (int).
11. A constructor to initialize the title, author, price and qty with the given values.
12. Also a default constructor to be used later in the array.
13. Public getters and setters method: getTitle(), getAuthor(), getPrice(), setPrice(), getQty(),
setQty().
14. A toString() that returns " title by author-name (gender) at email". You could reuse the
Author's toString() method, which returns "author-name (gender) at email". For e.g “Harry
Potter and the Philosopher’s Stone by J. K. Rowling(f) at jkrowling@gmail.com”
15. Base on your expertise show the relationship in the class diagram.
1. Write a java class name Author having the private members, constructor and methods
2. Write a java class name Book having the private members, constructor and methods
3. Write a java class name Library that will
2
CS200 – Assignment 2
4. Ask how many objects of book to create
5. Create an array of book objects
6. And will display the following menu
Marks allocation:
Total: 100
3
CS200 – Assignment 2