Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab guide #5.

Similar presentations


Presentation on theme: "Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab guide #5."— Presentation transcript:

1 Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang tung_hx@icu.ac.kr TA: Tran Minh Trung trungtm@icu.ac.kt Lab guide #5

2 XuanTung Hoang 2 LibMan - Project BookRec class -Title: String -ID: Int -Ammount: Int -Available: Int +setTitle(String title): void +getTitle(): String +setID(int ID): void +getID():int +setAmount(int anAmount):void +getAmmount():int +update(int n): void +getnAvailable():int LibMan class -libTitle: String -nBookshelves: Int -books: BookRecs +setTitle(String title): void +getTitle(): String +setnBookshelves (int n): void +getnBookshelves ():int +showLibInfo():void +addNewBook():void +placeBooktoBookshelf(int bookshe fID,BookRec bRec): void +bookStatus(int bookID):boolean +borrowBook(int bookID):void +returnBook(int bookID):void N 1 1 TestLibMan -option: int +main():void +showMenu():void +askOption():void

3 XuanTung Hoang 3 LibMan – new functions addNewBook()  Add new book bookStatus(bookID)  Available: Retuns true, Print out Title, # of books left  Otherwise: Return false borrowBook(bookID)  Check if the book is available or not  If available then borrow, and update the # of books left  Show again the updated status returnBook(bookID)  Update the # books left  Show again the updated status

4 XuanTung Hoang 4 LibMan – Template & requirements Links:  http://wine.icu.ac.kr/ice0124/lab5/BookRec.java http://wine.icu.ac.kr/ice0124/lab5/BookRec.java  http://wine.icu.ac.kr/ice0124/lab5/LibMan.java http://wine.icu.ac.kr/ice0124/lab5/LibMan.java  http://wine.icu.ac.kr/ice0124/lab5/TestLibMan.java http://wine.icu.ac.kr/ice0124/lab5/TestLibMan.java Requirements  Understand problem  Understand the structure of template code  Complete missed codes (fill in … area) Note: You can design your own program for solvi ng the problem

5 XuanTung Hoang 5 Templates & output examples TestLibMan.java C:\java TestLibMan ========== Main menu ======== 1. Show library information 2. Add new book 3. Show book's status 4. Borrow a book 5. Return a book ============================== Enter menu ID (1-5):

6 XuanTung Hoang 6 addNewBook() 2. Add new book ----------------------------- Enter book's information: (1)Possition: 1 (2)(2) ID: 1 (3) Amount: 20 (4) Title: Java tutorial 2009

7 XuanTung Hoang 7 bookStatus(bookID) 3. Show book's status ----------------------------- Enter book's ID: 1 Book title: Java tutorial 2009 Bookshelf ID: 1 Total amount: 20 Left amount: 20 3. Show book's status ----------------------------- Enter book's ID: 1 Book title: Java tutorial 2009 Bookshelf ID: 1 Total amount: 20 Left amount: 20

8 XuanTung Hoang 8 borrowBook(bookID) 4. Borrow a book ----------------------------- Enter book's ID: 1 Book title: Java tutorial 2009 Bookshelf ID: 1 Total amount: 20 Left amount: 20 The book is borrowed successfully! Book title: Java tutorial 2009 Bookshelf ID: 1 Total amount: 20 Left amount: 19

9 XuanTung Hoang 9 returnBook(bookID) 5. Return a book ----------------------------- Enter book's ID: 1 The book is returned successfully! Book title: Java tutorial 2009 Bookshelf ID: 1 Total amount: 20 Left amount: 20

10 XuanTung Hoang 10 Submission and Report Due: Right after lab time Compress your source/class files into a ZIP file Name the zip file according with the following template:  StudentID_labNumber.zip Example: 20091004_lab4.zip Submit the file to TA  Email address: submit.hw.code@gmail.comsubmit.hw.code@gmail.com  Subject: “StudentID_ICE0124_lab4” Example: 20061004_ICE0124_lab4


Download ppt "Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab guide #5."

Similar presentations


Ads by Google