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

Assignment-2 Spring 2023

The document describes an assignment for a CMPS 251 OOP concepts course. Students are asked to build a book review system using provided book, user, and review datasets. The system must include classes for Book, Location, User, and BookDataset, with specified attributes and methods. Students must submit their Java project as a zip file by the deadline.

Uploaded by

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

Assignment-2 Spring 2023

The document describes an assignment for a CMPS 251 OOP concepts course. Students are asked to build a book review system using provided book, user, and review datasets. The system must include classes for Book, Location, User, and BookDataset, with specified attributes and methods. Students must submit their Java project as a zip file by the deadline.

Uploaded by

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

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

Submission deadline: Wednesday, May 24 [End-of-day, 11:59pm]

Important Notes:
1. Submit through Blackboard, NO other means like email, etc., are accepted. Make sure that:
 You submit one exported Eclipse archive file with all related Eclipse Project in it.
 Click on File > Export. Then Expand “General” and select “Archive File”.
 On the next page, select the related Eclipse project and name the archive file as following:
<First_Name>_<Last_Name>_<QUID>_HW2.zip.
 Submit this archive in blackboard. If your name is Fahad Al-Thani with ID 20223842 then
your file would be named Fahad_Al-Thani_20223842_HW2.zip
2. Assignments are to be solved individually.
 This is very important for your learning.
 You should NOT write-up solutions together NOR copy solutions that are not YOURS, NOR
give your solutions to others.
3. Submit your work as instructed above before the deadline.
 Start working on the assignment early.
 Avoid last minutes submissions.
 There will be NO extension to the submission deadline.
 If you have any uncertainty, questions, or doubts about any of the above, ask your
instructor!

Honor Code Agreement


I understand that submitting work that is not my own, or sharing my work with
others will result in a “Zero” grade and in disciplinary actions.

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023


CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

Assignment Details:

You are to build a book review OOP system using the data in the given dataset described
below.

The Book-Crossing dataset comprises 3 files.

Books

1. Books are identified by their respective ISBN which are unique. Invalid ISBNs have
already been removed from the dataset. Moreover, some content-based information
is given (Book-Title, Book-Author, Year-Of- Publication, Publisher), obtained from
Amazon Web Services. Note that in case of several authors, only the first is provided.

Users

2. Contains the users. Note that user IDs (User-ID) have been anonymized and map to
unique serially incremented integers. Demographic data is provided (Location, Age) if
available. Otherwise, these fields contain NULL-values, empty.

Reviews

3. Contains the book rating information. Ratings (Book-Rating) are either explicit,
expressed on a scale from 1-10 (higher values denoting higher appreciation), or
implicit, expressed by 0. A user might have reviewed multiple books and a book might
have been reviewed by multiple users. Full processing of this file is required for each
book and each user that takes a very long time. Therefore, you will use the file
Reviews_small.csv instead.

Assignment Tasks:

1. Code the following classes:

Book
Attributes: Instance attributes representing:
isbn, bookTitle, bookAuthor, yearOfPublication, publisher, rating, and ratingCount

Methods:
• toString
• constructor: it also initializes rating and ratingCount to 0

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023


CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

Location
Attributes: instance attributes representing:
city, state, and country
Methods:
• toString
• constructor
User
Attributes: instance attributes representing:
userId, password, location, age, and the list reviewed

Methods:

• toString
• constructor: initializes the reviewed list to empty list. Calls the private method
setPassword that assigns the value of the first letter from the value of each attribute
of the location object followed by the integer value of the age or 0 if there is no value
of the age.
• setPassword

Bookdataset

Attributes: instance attributes representing the lists:


books, and users.

Methods:
• constructor: for the first time you run your program, it constructs the book objects
using the data in the Books.csv file and saves them in the books list as well as writes
them to book.dat file. In subsequent runs, it loads book list with the books objects
saved in the file book.dat. The same applies to the user objects.
• loadBooks: uses the data in the file Book.csv to create objects of Book and save it in
the list books.
• loadUsers: uses the data in the file User.csv to create objects of User and save it in the
list users.
• initRating: uses the data in the file Review_small.csv to calculate the average rating
and rating_count for each book in the list books and assigns it to the rating and
ratingCount attributes of that book.
• initReviewed: uses the data in the file Review_small.csv to find the books that have
been reviewed by each user in the list users and add them to the reviewed list attribute
of that user.
• loadObjs: reads the objects stored in book.dat and append them in the books list. It
also reads the objects stored in users.dat and append them to the users list.

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023


CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

• storeObjs: saves in books.dat the book objects of the books list. It also saves in
users.dat the user objects of the books list.
• searchBooks: it returns the matching book objects from the books list for a given name
of a book’s attribute and its value.
• searchUsers: returns the matching user objects from the users list for a given name of
a user’s attribute and its value. Any one of the attributes: userId, age, city, or state, or
country of location.
• sortBooks: it sorts a books list using any one of the book’s attributes.

App
Attributes: private instance attributes representing:
username, password, and bookdataset which is an object of the Bookdataset class.

Methods:
• Proper constructor: is also calls showMenu method.
• showMenu: it display options for the user to:
• Search for a book using any combination of values of a book’s attributes and display
the matching books.
• Sort the displayed list of books using any one of the books attributes.
• Search for a user using any combination of values of a user’s attributes and returns the
matching user objects from the users list.
• main

What to submit

1. Submit your work on Blackboard (Due on May 24, 2023) NO EXTENSIONS.

• A zipped java project with the name hw2_id.zip

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023


CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

Sample menu
1: Login
2: Exit
Choose an option [1-2]: 1
Username: admin
Password: admin
Main Options:
1: Sort books
2: Search books
3: Search users
4: logout
5: Exit
Choose an option [1-5]: 1
Book Sort Option By:
1: ISBN
2: Title
3: Author name
4: Year of publication
5: Publisher
6: Rating out of 10
7: Rating count
8: Back to main menu
Your choice: 2
..............
..............
Book Sort Option By:
1: ISBN
2: Title
3: Author name
4: Year of publication
5: Publisher
6: Rating out of 10
7: Rating count
8: Back to main menu
Your choice: 8
Main Options:
1: Sort books
2: Search books
3: Search users
4: logout
5: Exit
Choose an option [1-5]: 2
Book Search Option By:
1: ISBN
2: Title
3: Author name
4: Year of publication
5: Publisher
6: Rating out of 10
7: Rating count
8: Back to main menu
Your choice [1-8]: 4
Year of Publication: 1990
.....
.....
Book Search Option By:
1: ISBN
2: Title
3: Author name

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023


CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

4: Year of publication
5: Publisher
6: Rating out of 10
7: Rating count
8: Back to main menu
Your choice [1-8]: 8
Main Options:
1: Sort books
2: Search books
3: Search users
4: logout
5: Exit
Choose an option [1-5]: 3
User Search Option By:
1: User ID
2: Age
3: City
4: State
5: Country
6: Back to main menu
Your choice [1-6]: 2
Age: 30
............
............
User Search Option By:
1: User ID
2: Age
3: City
4: State
5: Country
6: Back to main menu
Your choice [1-6]:6
Main Options:
1: Sort books
2: Search books
3: Search users
4: logout
5: Exit
Choose an option [1-5]: 4
1: Login
2: Exit
Choose an option [1-2]: 2

CMPS 251 (OOP CONCEPTS ) ASSIGNMENT-2 CSE-CENG-QU, SPRING2023

You might also like