0% found this document useful (0 votes)
12 views

CS200 - Assignment 2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

CS200 - Assignment 2

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Diploma in Interactive and Digital Media

CS200 Object Oriented Programming

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.

1. First, a class called Author. It contains:


2. Three private member variables: name (String), email (String), and gender (char of either
'm' or 'f').
3. A constructor to initialize the name, email and gender with the given values.
4. There is no default constructor, as there is no default value for name, email and gender.
5. Public getters/setters methods: getName(), getEmail(), setEmail(), and getGender().
6. There are no setters for name and gender, as these properties are not designed to be
changed.
7. A toString() method that returns "name (gender) at email", e.g., " J. K. Rowling(f) at
jkrowling@gmail.com ".

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.

Task B: Class Creation


Description
You are requested to develop a program to show usage of the above classes.

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

What do you want to do?


1. Enter a new Book
2. Change information of an existing Book
3. Display all details of a Book
4. Display list of all Books
5. Quit

Please enter your choice >

7. If user select 1, he will be prompted to insert details of book


8. If user select 2, he will be prompted to insert book title to search. Then if found, user can
modify appropriate values.
9. If user select 3, he will be prompted to insert book title to search. Then if found, he will
see all details of the book.
10. If user select 4, he will get a list of all books (toString() method)
11. If user select 5, program is exit

Marks allocation:
 Total: 100

Class diagram: 30 marks


Code Class Author: 15 marks
Code Class Book: 15 marks
Code Class Library + menu: 15 marks
Option 1: 5 marks
Option 2,3: 15 marks
Option 4: 5 marks

3
CS200 – Assignment 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy