logo

Tracking Progress on Required Books

   

Added on  2019-09-18

7 Pages3311 Words459 Views
 | 
 | 
 | 
CP1404/CP5632 2016 SP23/53 Assignment 1 – Reading List 1.0Task:You are to plan and then code a console-based program in Python 3, as described in the following information and sample output. This assignment will help you build skills using selection, repetition, file input/output, exceptions, lists, functions and string formatting. Do not to define any of your own classes. Assignment 2 will build on this program with more advanced code constructs including classesand a Graphical User Interface (GUI). Work incrementally on this task: complete small parts of it at a time rather than trying to get it all working at once. Some requirements have in-text references like [0] that refer to the resources list near the bottom. Everything you need to know to complete this assignment can be found in the subject materials.Program Overview:This program is a simple reading list that allows a user to track books they wish to read and books theyhave completed reading. The program maintains a list of books in a file, and each book has:title, author, number of pages, whether it is required or completed (r or c)Users can choose to see the list of required books or completed books, including a total of the numberof pages of the book list. The lists will be sorted by author then by number of pages (increasing). [1]Users can add new books and mark books as completed. They cannot change books from completed to required.Program Functionality Details:Ensure that your program has the following features, as demonstrated in the sample output below.Your program should:display a welcome message with your name in itdisplay a menu for the user to choose from [2]return to the menu after each action and loop until the user chooses to quiterror-check user inputs as demonstrated in the sample output [3]load a CSV (Comma Separated Values) file of books (just once at the very start); a sample CSVfile is provided for you and you must use this format [4]when the user chooses list required: display a neatly formatted (lined up) list of all the requiredbooks with their details and a total of the number of pages of these books [3]when the user chooses list completed: display a similarly formatted list of completed bookswhen the user chooses add: prompt for the book’s title, author and number of pages, error-checking each of these, then add the book to the list in memory (not to the file)when the user chooses mark completed: display the list of required books (same as for list),then allow the user to choose one book (error-checked), then change that book to completedoif no books are required, then a "No books" message should be displayed and the userreturned to the menu (this is the same if there are no completed books)when the user chooses quit: save the books to the CSV file, overwriting the file contentsPlanning:Write up the algorithms in pseudocode for the two functions: load books and complete a book. Do this in a docstring (comment) directly above each of these functions.At the very top of your code file, add a docstring containing your name, date, brief program detailsand a link to your project on GitHub.Follow the guide to good pseudocode and examples presented in the subject to ensure this is done to a high standard. [5] You may show this part of the assignment to your tutor during practical time to get comments or suggestions. You may do pseudocode for more than these two functions, but it is not required.CP1404/CP5632 SP2 Assignment 1 © 2016 – Information Technology @ James Cook University1/7
Tracking Progress on Required Books_1

Coding Requirements and Suggestions:Make use of named constants where appropriate. Use functions appropriately for each significant part of the program: this is the divide-and-conquer problem-solving approach. Remember that functions should “do one thing”. Look for situations where functions can be used to reduce code duplication (e.g. when you display the required lists and when you mark a book as completed – this is very similar).For efficiency, you should only load the books file once. Store the results appropriately in a listof lists and pass that to any functions that need access to it. Note: this variable should not beglobal. The only global variables you may have are CONSTANTS.Note that the menu choice should handle uppercase and lowercase letters.Use exception handling where appropriate to deal with input errors (including entering numbersand selecting books). You should be able to use generic, customisable functions to perform input with error checking (e.g. getting the title and author can reuse the same function).Check the rubric carefully to see any other aspects of the coding that you will be assessed on.Output Requirements:Sample output from the program is provided below. Ensure that your program matches the sample output including spaces, spelling, and especially the formatting of the book lists. Think of this as helpful guidance as well as training you to pay attention to detail. The sample output is intended to show the full range of situations including user input error handling.Submission:The assignment 'starter' will be provided to you via GitHub Classroom (see below). This will include the books CSV file and a Python file called CP1404assignment1.pySubmit this Python 3 (.py) code file containing your comments and pseudocode by uploading it on LearnJCU under Assessment (click on the title of the assignment).Git/GitHub:You must use Git version control and keep your project updated online in GitHub. If you have not yet created a GitHub account, do this now as explained at https://github.com/CP1404/Starter/wiki/Software-Setup#githubYou must be easily identifiable from your GitHub username. Make sure you register for the student discount so you get free private repositories: https://education.github.com/discount_requests/newYou are assessed on your use of version control including commits and commit messages, so commit regularly (each logical chunk or milestone) and use meaningful commit messages in the imperative voice. Your commits should show steady work completed over reasonable time, not all in a short period.Due:Submit your assignment bythe date and time specified on LearnJCU.Submissions received after this date will incur late penalties as described in the subject outline.Integrity:The work you submit for this assignment must be your own. You are allowed to discuss the assignmentwith other students and get assistance from your peers, but you may not do any part of anyone else’s work for them and you may not get anyone else to do any part of your work. Note that this means you should never give a copy of your work to anyone or accept a copy of anyone else’s work. Submissions that are detected to be too similar to that of another student will be dealt with according to the College procedures for handling plagiarism and may result in serious penalties.If you require assistance with the assignment, please ask general questions on the discussion forum, or get specific assistance with your own work by talking with your lecturer or tutor.CP1404/CP5632 SP2 Assignment 1 © 2016 – Information Technology @ James Cook University2/7
Tracking Progress on Required Books_2

Sample Output:The following sample run was made using a CSV file that contained:The Practice of Computing Using Python,Punch and Enbody,792,rThe 360 Degree Leader,John Maxwell,369,rIn Search of Lost Time,Marcel Proust,365,cDeveloping the Leader Within You,John Maxwell,225,rBold greentext below shows user input for this sample.Reading List 1.0 - by Lindsay Ward4 books loaded from books.csvMenu:R - List required books C - List completed booksA - Add new bookM - Mark a book as completedQ - Quit>>> rRequired books: 0. Developing the Leader Within You by John Maxwell 225 pages 1. The 360 Degree Leader by John Maxwell 369 pages 3. The Practice of Computing Using Python by Punch and Enbody 792 pagesTotal pages for 3 books: 1386Menu:R - List required books C - List completed booksA - Add new bookM - Mark a book as completedQ - Quit>>> cCompleted books: 2. In Search of Lost Time by Marcel Proust 365 pagesTotal pages for 1 books: 365Menu:R - List required books C - List completed booksA - Add new bookM - Mark a book as completedQ - Quit>>> mRequired books: 0. Developing the Leader Within You by John Maxwell 225 pages 1. The 360 Degree Leader by John Maxwell 369 pages 3. The Practice of Computing Using Python by Punch and Enbody 792 pagesTotal pages for 3 books: 1386Enter the number of a book to mark as completed>>> oneInvalid input; enter a valid number>>> 2That book is already completedMenu:R - List required books C - List completed booksA - Add new bookM - Mark a book as completedQ - Quit>>> mRequired books: 0. Developing the Leader Within You by John Maxwell 225 pages 1. The 360 Degree Leader by John Maxwell 369 pages 3. The Practice of Computing Using Python by Punch and Enbody 792 pagesTotal pages for 3 books: 1386Enter the number of a book to mark as completed>>> 1The 360 Degree Leader by John Maxwell marked as completedMenu:R - List required books C - List completed booksA - Add new bookM - Mark a book as completedCP1404/CP5632 SP2 Assignment 1 © 2016 – Information Technology @ James Cook University3/7
Tracking Progress on Required Books_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents