CSE 1320 – Intermediate Programming Homework 7 Due date: Tuesday, April 28, 2015, 11:59pm. This is the firm due date. Any submissions will be not considered after the due date. We are going to make a C program named “Library Manager”. The program manages books for a library (adding, removing, checking in/out, and so on). The main menu is following. 1. 2. 3. 4. 5. 6. 7. 8. Add a new book Remove a book (input ISBN) Check out a book (input ISBN and the due date) Check in a book (input ISBN) Display all book details (along with their specialization) Display all available book details Display all checked-out books Exit program Each book has following properties such as ISBN, title, and so on (please see the next page). Please create a “Book” structure consisting of the members. Then, you have to ask such information of a book to a user when adding a new book. Please check if the input is valid or not. In this program, ISBN is a key, which means an identifier of a book (i.e., we assume that there is only one book of the ISBN in this library, though it’s unrealistic in practice). When adding a new book, you have to check if there is the same ISBN already stored in the library. If so, you have to give an error message to a user and ask again to input a different ISBN. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Has an ISBN (10 digits): e.g., 1001234567 Has a title (string): e.g., Java Programming Language Has a type (string): e.g., textbook, magazine, journal, newspaper, novel, and other Has a publisher (string): e.g., UT Arlington Press Has a page information (how many pages) (integer): e.g., 506 Has a price (float): e.g., 20.00 Has a publication year (integer): e.g., 2013 Has a status (integer): e.g., 0=available, 1=checked-out Has a name who checked out the book (string): e.g., Tommy Has a due date (Date): use Date structure Please use the “Date” structure for “Due Date” described as, struct Date { int nYear; int nMonth; int nDay; }; You have to check whether the date input is valid or not. Consider a leap year for the validation. E.g., 2-29-2014 is not valid. The Library manager may have a 1D array of the Book structure. You can define the maximum book number (e.g., 100) that the library can store. When exiting the program, you have to store all of the information into a file. Then, you can load and initialize the data from a file when beginning the program if there is a data file. You can define the file format for yourself. However, please describe what you did for the file format at “File_Description.txt”. Bonus (50 points) If you display how many days are left before the due date for check-out books on Menu 5 and Menu 7, you will have extra 50 points. File_Description.txt This describes how you store the data into a file. Example, The file has ten sequential blocks of the following data structure, 1-10 (bytes) for char types: ISBN 11-110 for char types: Title 111-150 for char types: Book type …. Grading: - The assignment will be graded out of 100 points. - A couple of homework submissions will be selected as the BEST program and will be given extra 15 points more. The codes will be posted in the course web site to share the nice codes with your friends. - For the BEST program, I will consider readability, coding style, creative codes and outputs. How to submit: 1. The submission must include, as an attachment, a zip file containing two files for the two tasks. E.g., LibraryManager.c and File_Description.txt. 2. You don’t have to check your program on Omega server for HW7. 3. Please submit it to BlackBoard (http://elearn.uta.edu).
© Copyright 2024