0% found this document useful (0 votes)
78 views13 pages

Assignment 2-OOP-Screenshots

The document provides instructions for an object-oriented programming assignment for an online library system. It consists of 3 tasks: 1) Developing classes for a UserList and BookList with various methods like searching, adding, deleting etc. 2) Writing a demo program to demonstrate the class functions. 3) Adding documentation like headers and comments to write high-quality code. Students need to submit their work as a zip file following the provided naming convention. The grading criteria and a sample run of the program are also included.

Uploaded by

Mohamed Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views13 pages

Assignment 2-OOP-Screenshots

The document provides instructions for an object-oriented programming assignment for an online library system. It consists of 3 tasks: 1) Developing classes for a UserList and BookList with various methods like searching, adding, deleting etc. 2) Writing a demo program to demonstrate the class functions. 3) Adding documentation like headers and comments to write high-quality code. Students need to submit their work as a zip file following the provided naming convention. The grading criteria and a sample run of the program are also included.

Uploaded by

Mohamed Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Object-Oriented Programming

Assignment 2 (20 Marks) Cairo University, Faculty of


Computers and Information

Instructions
1- Students will be the same groups of assignment 1.
2- Deadline of submission is Dec 23rd at 11:55 pm.
3- Please submit only work that you did yourself. If you copy work from your friend or
book or the internet, you will lose the marks of this assignment.

Task 1 (17 Marks)


Online library system
Using classes and arrays, the team will develop a set of functions for online library
system. A system is represented by the following structure:

class UserList (7 marks)


{
private:
User* users;
int capacity;
int usersCount;

public:
UserList(int capacity);
void addUser(User user); // at the end of the array.
User& searchUser(string name);
User& searchUser(int id);
void deleteUser(int id);
friend ostream &operator<<( ostream &output, UserList &userList )//to display all
books
~UserList();
};

class BookList (10 marks)


{
private:
Book* books;
int capacity;
int booksCount;
public:
BookList(const BookList& anotherList);
BookList(int capacity);
Book& searchBook(string name);
Book& searchBook(int id);
1
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information
void deleteBook(int id); //delete a book
Book getTheHighestRatedBook();
Book* getBooksForUser(User); // get all books of this author
Book & operator [ ] (int position);
friend ostream &operator<<( ostream &output, BookList &booklist ); //to display all books
~BookList();

};

//Note: when you delete a book, the book could be in the middle of the array, which will leave a
gap in your array of books. You should fill the gap by shifting all the books to the right of the
deleted book one place to the left.
The same scenario should happen when deleting a user.

B1 B2 B3 B4 B5 deleteBook(2)
id=1 id=2 id=3 id=4 id=5

B1 B3 B4 B5
id=1 id=3 id=4 id=5

2
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

General Notes:
1- Please make sure to adhere to the provided classes’ interfaces.
2- You can add any required functions to help you to get the outputs.
3- Submission will include 4 classes and their implementation (Book, User,
BookList, UserList) and a main function that provides the same experience as the
screenshots provided.

Task 2 (3 Marks)
- Team should write a demo program to demonstrate the use of these functions.
- Team should test the entire program and make sure that it works correctly in full.
- All team members must fully understand all parts of the program.

Task 3 - Writing Good Quality Code


No program stays the same. It will need to change to fix bugs, add new features, etc. So,
it is very important to write high quality readable code, so that you or other developers
can be able to review and modify this code in the future. In this task, you will:

1- Add a header to your program saying who the author is, the purpose of the
program, etc.
2- Add a header for every function explaining what it does, what parameters it takes
and what value it returns.
3- Write the code following C++ coding style.
http://geosoft.no/development/cppstyle.html
4- Add comments to any part that is difficult to understand.

Note: if you didn’t do it you will lose 1 mark.

Grading criteria (Total 20 marks)


Task 1 [17 marks]
- User class (7 marks)
- Parameterized constructor (1 mark)
- add user (1 mark)
- two searching methods (2 mark)
- delete user (1 mark)
- Operator << (1 mark)
3
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information
-destructor(1 mark)
- Book class (10 mark)
- Parameterized constructor (1 mark)
- Copy constructor (1 mark)
- two searching methods (2 mark)
- delete book (1 mark)
- Operator << and operator [] (2 mark)
- highest Rate book function (1 mark)
-get book for user (1 mark)
-destructor (1 mark)
- Task 2 - General Checks and Main [3 mark]
- Creating userlist object in the main (1 mark)
- Creating booklist object in the main (1 mark)
- Follow the classes’ interfaces (1 mark)

Submission Instructions
1- Only 1 member of the team will submit into Blackboard a zip file. Carefully follow the
mentioned steps to create your zip file: a. Go to the folder of your project and create a new
text file (names.cpp) with the names and IDs of the team. b. Delete the exe file of the project
found in the bin directory c. Zip the whole folder of the project and name it in the following
form ID1_ID2, where ID1 is id of the first student and ID2 is the id of the second student. Ex.
(20192222_20198888)

2- All team members must understand the details of the entire program and be able to
explain it or even modify it if needed.

3- TA can ask any team member about any of the programs developed and its code.

By failing to follow the submission instructions of the assignment, you are risking
your assignment’s grade.

4
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

A Sample Run

5
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

6
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

7
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

8
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

9
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

10
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

11
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

12
Object-Oriented Programming
Assignment 2 (20 Marks) Cairo University, Faculty of
Computers and Information

13

You might also like