1. Homepage
  2. Programming
  3. 159.234 Object-oriented programming - Assignment 2:University Library System

159.234 Object-oriented programming - Assignment 2:University Library System

Engage in a Conversation
159.234159234Object-oriented programmingJava

159.2 34 OBJECT -ORIENTED PROGRAMMING Assignment 2 CourseNana.COM

Late Submission : Deduct 5 mark s per day late Indiv idual Work You must complete this assignment by yourself (you must NOT share your code with others or use others’ code including the code generated by Artificial Intelligence platforms such as ChatGPT) Purpose: Reinforce Java OOP core concepts (abstraction, encapsulation, inheritance, and polymorphism) , collect ions framework and generics, exception handling, and input and o utput streams . CourseNana.COM

  1. System Description (Overview of Problem) You are asked to write a program in Java to simulate a University Library Syste m Three types of items can be borrowed from the library —Books, Journals , and Movies. The library records each item’s type, ID, title, year, average rating, number of reviews, and max imum borrowing time (28 days for Books, 14 days for Journals, and 7 days for Movies). Furthermor e, for books, the library must record author and number of pages ; for movies, it must record director ; and for journals, it must record volume and number . Due dates must be recorded for all items out on loan . CourseNana.COM

  2. Programming t asks to complete: A. Read text file library.txt (supplied ); for each line in this file, create a Movie/Book/Journal object and add it to your ‘ library ’ object B. List all items in the library , but only display its ID , type , and title C. Prompt questions to allow users to do the following ( refer to attached sample output at the end of this document for expect ed prompts and display details): a. Sort all the items first by average rating and then by ID b. Search items by ID or phrase in title , and list the items found c. Select an item from search resu lts and display its details d. Borrow the selected item if it is available, and display new due date, or e. Return the selected item if it is on loan, or f. Rate the selected item and display new average rating CourseNana.COM

  3. Functions workflow (related tasks are marked as A, B, C -a, C-b, C-d, C-d, C-e, and C -f): CourseNana.COM

    Run your program Create and add library items to your system (A) and output all the items (B) Search by ‘id’ or ‘phrase in title ’ (C-b) quit enter ‘id’ Display selected item details (C-c) Borrow or rate the item (C-d, C-f) Return or rate the item (C-e, C-f) if item is available if item is on loan Display item details after borrowed or rated (C-d, C-f) borrow rate, enter rate value Display item details after returned or rated (C-e, C-f) return rate, enter rate value restart restart restart restart List the matching item (C-b) Selected the item title’ enter ‘phrase in title’ List all the matching items (C-b) Selected one of the displayed items title’ restart restart Restart search by ‘title’ Restart search by ‘id’ Sort all the items (first by avera ge rating and th en by id ) (C-a) quit 2 159.2 34 OBJECT -ORIENTED PROGRAMMING S1, 202 3 CourseNana.COM

  4. Design and Implementation Guidelines CourseNana.COM

Note: You will receive credit for correctness, completeness, no code duplication, and clear on -screen output s. Also, t he following OOP and general software development guidelines will be checked while marking your program : CourseNana.COM

1) Encapsulation design and implementation —proper use of modifiers a. Private /Protected /Public b. Must make use of getters and setters wherever appropriate. CourseNana.COM

2) Inheritance design and implementation a. Reasonable class hierarchies b. Proper data -fields separation in base and derived classes c. Proper methods separation/overloading/overr iding in bas e and derived classes d. Proper use of base and derived class constructors CourseNana.COM

3) Polymorphism and implementation a. Write generic code that targets the base class whenever possible b. Appropriate use of overr iding in derived classes to realize polymorphism CourseNana.COM

4) Collections framework and generics a. Use ArrayList or another Java collection class to store information b. Implement Comparable/Comparator Interface (s) to sort items CourseNana.COM

5) Exception handling a. Throw exception s when an error occurs ( e.g., an inval id piece of data is entered) b. Use “try/catch/finally ” or “try/catch” block to handle exception s CourseNana.COM

  1. Other Specifications

You must follow the next five specifications when completing this assignment: CourseNana.COM

1) Create the method displayInfo to provid e appropriate information as shown below . The content of displayInfo should be the first thing that displays on screen CourseNana.COM

2) Place appropriate comments in your program – e.g.: /* explain what the program file is doing . . . / // explain what a part/method of the program is doing … 3) DO NOT add any file path for ‘library.txt’ (put it directly in your project folder when you test your code) 4) DO NOT add your own package name(s) to the beginning of your .java file 5) DO NOT use any function to clean the screen at any stage of your program CourseNana.COM

3 159.234 OBJECT -ORIENTED PROGRAMMING S1, 2023 CourseNana.COM

  1. Submission Requirements: 1) Zip all your source code (.java files ) and submi t as a single zip file to Stream CourseNana.COM

  2. Test data and sample outputs : CourseNana.COM

Task A: Input test data from library.txt file (supplied ) into your system CourseNana.COM

Task B: List all items in the library CourseNana.COM

Record of movie: Type, I D, title, year, director Record of book: Type, ID, title, year, author, number of pages Record of journal: Type, I D, title, year, volume, number CourseNana.COM

4 159.234 OBJECT -ORIENTED PROGRAMMING S1, 2023 CourseNana.COM

Task C: Prompt questions to allow the user to select all the functions: CourseNana.COM

The initial value of ‘Average rating’ ; number of reviewers’ should be set to 0 for all items at beginning The initial value of ‘Status’ should be set to ‘available’ for all items (none out on loan yet ) As the initial value of ‘Average rating’ is 0 for all items, list is sorted by ‘ID’ CourseNana.COM

5 159.234 OBJECT -ORIENTED PROGRAMMING S1, 2023 CourseNana.COM

Only one rating is available so the user entered rating value (7 in this example) equal to the ‘Average rating’ ‘Number of reviewers’ changed from 0 to 1 after item received its first rating Multiple rating s for an item are allowed from one user, so after their second rating, ‘Average rating’ is: (8+7)/2= 7.5 ‘Number of reviewers’ changed from 1 to 2 after item’s second rating CourseNana.COM

6 159.234 OBJECT -ORIENTED PROGRAMMING S1, 2023 CourseNana.COM

The item’s status changed to ‘on loan’ after being borrowed Due date is current date + max number of days for borrowing CourseNana.COM

To calculate dat e in Java, you may use java library java.util.Calendar , java.text.SimpleDateFormat , etc. ‘Status’ becomes ‘available’ after an item is returned There are two items whose titles include ‘lord’ (searching should not be case - sensitive) ; see ‘1’ and ‘2’ CourseNana.COM

7 159.234 OBJECT -ORIENTED PROGRAMMING S1, 2023 CourseNana.COM

This round, sort first by ‘average rating’ (descend ing order ) and then by ‘ID’ (ascending order ) CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
159.234代写,159234代写,Object-oriented programming代写,Java代写,159.234代编,159234代编,Object-oriented programming代编,Java代编,159.234代考,159234代考,Object-oriented programming代考,Java代考,159.234help,159234help,Object-oriented programminghelp,Javahelp,159.234作业代写,159234作业代写,Object-oriented programming作业代写,Java作业代写,159.234编程代写,159234编程代写,Object-oriented programming编程代写,Java编程代写,159.234programming help,159234programming help,Object-oriented programmingprogramming help,Javaprogramming help,159.234assignment help,159234assignment help,Object-oriented programmingassignment help,Javaassignment help,159.234solution,159234solution,Object-oriented programmingsolution,Javasolution,