CSC113_Tutorial4 - searchAll(t string int  returns an...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
King Saud University College of Computer and Information Systems, Department of Computer Science CSC 113: Java Programming-II, Spring2011, February 21, 2011 Tutorial #4 : Relationships between Classes Write the Java code for the following two classes as well as a main program: Library : Library (size:int): addBook (Bid:int, Btitle: string, type: string, int p) : bool returns true if addition completed addBook (Book b): bool returns true if addition completed searchLast (id: int): int search for the last book having the given id; if found returns its index or negative value otherwise searchIth (t: string, i:int): int search for the ith book having the title t; if found returns the Book index or negative value otherwise
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview:  searchAll (t : string): int[]  returns an array that contains the indexes of every book of Type t  count (t: string ): int  return the number of books that have type t  split (l1: Library, l2: Library, t: Type )  copies all books of type t in l1; the others are copied in l2. Library Book -name: string + Library(size:int) + addBook(Bid:int, Btitle: string, type: string, int p) + addBook(Book b): bool + searchLast(id: int): int + searchIth(t: string): int + searchAll(t : string): int[] + count(t: string ): int + split(l1: Library, l2:Library, t: Type -id: Int -title: string -type: string -pages:int + constructor+ Setters/getters + display() Books 1 *...
View Full Document

This note was uploaded on 08/18/2011 for the course COMPUTER S CSC 113 taught by Professor Dr.safwanqasem during the Spring '11 term at King Saud University.

Ask a homework question - tutors are online