Modules:
Functions:
CLASS BookUtils
FUNCTION appendBook(filePath, book)
TRY
OPEN file at filePath in append mode
WRITE book.toString() to file
WRITE new line to file
CATCH IOException
PRINT error message
END TRY
END FUNCTION
FUNCTION getBooks(filePath)
CREATE empty list called books
TRY
OPEN file at filePath for reading
WHILE there are lines to read
READ line
SPLIT line by comma into details array
IF details array has 4 elements
CREATE new Book object with details
ADD Book object to books list
END IF
CATCH IOException
PRINT error message
END TRY
RETURN books
END FUNCTION
FUNCTION findBook(filePath, name)
books = getBooks(filePath)
FOR EACH book in books
IF book.name equals name
PRINT "Name found: " + book
RETURN book
END IF
PRINT "Name not found."
RETURN null
END FUNCTION
FUNCTION updateBookStatus(filePath, name, status)
books = getBooks(filePath)
FOR EACH book in books
IF book.name equals name
PRINT "Found book: " + book
SET book.issued to status
BREAK loop
END IF
END FOR EACH
TRY
OPEN file at filePath for writing
FOR EACH book in books
WRITE book.toString() to file
WRITE new line to file
CATCH IOException
PRINT error message
END TRY
END FUNCTION
END CLASS