Here's an example of a pseudo-code algorithm to borrow required and optional textbooks for a class, using
parameters for the course number and section number:
To borrow books for CS 110A Section 001, you would write:
BorrowBooks(CourseNumber="CS 110A", SectionNumber="001");
To borrow books for English 1A Section 581, you would write:
BorrowBooks(CourseNumber="ENGL 1A", SectionNumber="581");
Here is the generic algorithm to borrow books:
BorrowBooks(CourseNumber, SectionNumber):
- Go to the Library.
- Repeat for each required book for this course section:
- Determine the required book's title and author.
- Describe the path to the shelf.
- Go and pick up a copy of the required book and put it in your bag.
- Repeat for each optional book:
- Determine the optional book's title and author.
- Describe the path to the shelf.
- Go to the shelf.
- Look at optional book to decide if you want to borrow it:
- If you want to borrow the optional book:
- Pick up a copy of the required book and put it in your bag.
- If you do not want to borrow the optional book:
- Put the optional book back on shelf.
- Go to the checkout station.
- Scan identification and borrow book.
- Exit the library with your books.