Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer the question perfectly and don't beat around the bush I have only 2 days to complete it answer it within 2 days and
Please answer the question perfectly and don't beat around the bush I have only 2 days to complete it answer it within 2 days and please don't submit wrong answer i'll have to dislike it
This is the best I can upload and these are not at all hazzy now could you please answer the question now
Problem Data Processing An acquaintance of yours a librarian at an elementary school in rural area who is still maintaining the library holdings manually on paper, has contacted you for assistance. They have acquired a computer and knowing that you are taking CMPUT 175 they have asked you to help write a program to automate some of the processes. Using a spreadsheet, they have already started collecting data that they can provide you intox-formatted files. Your python program would use these text formatted files as input and produce as output lists that can be printed. The files that you have as input are as follows The first bie, booles.but contains the list of all the books in the library. Each line of the file contains information about a book: Book D followed by a pound ( followed by a title, followed by a pound followed by the author names followed again by a pound and finally followed by a value in dollars. For example the content of the file could look like this 0123456h out and the motorcycle beverly Char30.5 1234567Charlotte's Welwyn Brooksis 835475daald DIRES arry Potter and the prisoner of Ashaarne Boving? 858256) and the glat peacoald D3 24653 The chestad Dah22 199815 Lockingsta Lindgrens. 5100352the battle of the labyrintstick Riordan 25 The second tile students.but contains the list of students. Each line concerns one student and is formatted as follows Studenti, student name, cles, all separated by a commal! For ample, the content of the file could look like this 5983347, Susanne Foster 20 598132), Eric Xu, 28 5980127, LE, A SOS, Myria Salah S962234, All Rattany, lo 5987654, Kevin Kelly, The third ble borrowers.txt contains the history of all loans. Each line huis Hook ID followed by a Student ID followed by a date the book was borrowed followed by the expected date the book is supposed to be returned. The dates are formatted in string of 6 characters, the year followed by the month followed by the day. For instance the shof January 2002 would be 22010. This way dates can be compared. Indeed 220105220131. All felds are separated by a semi columnFor example the content of the borrowers but content could be like this 6123458,5983543,22010;228201 1234567;5343,730110220215 A fourth file returns.txt contains information about the return fachline has a Book ID followed by a Student 10 followed by a date the book was registered as returned followed by the state of the book. The date is formatted as in the previous file YMMDD and the state of the book is either O meaning the book is in good itate, if the book was lost, if the book was lost and paid. "If the book was damaged and paid, otherwise it means the book was damaged and needs replacement but hasn't been paid yet. All fields are separated by a semi column Here is an example of how the file could look like 0123456;5985543,20301; 6234587,5983342;22021537 for all four input files you can assume that there will not be whitespace at the beginning of each line. box will there be blank lines in the file. You can also assume that all Books used in borrowers by indreture defined in bookstat and all students in borrowers and returns. we defined in students bet Your Python programmus generate a file standing.txt that contains for each classroom two tables. The first table is listing of the books that have been returned yet and the name of the borrower sorted by the bortswers name with the due date. This table should only contain the books that have been returned, this informations can be obtained from borowes.txt and returns.bt. The due date is the date the book is supposed to be returned. The second table assorted by the studentsnames contains the amount due by students. The student owes the cost of the book from the books tot of the book wit the state of the book is in the return.file or damaged but not paid back statusa not. 1. 2. 3 in the Both tables as shown below end with a total. In one cas, as the count of books borrowed by students in the classroom and in the second car the total of money due by all students in the dassroom Class: 20 1 Student Boor I Due Date Eric arry Potter and the prisoner of Ateb 15, 2073 Susanne Foster Pipi Longstocking Feb 15, 2012 Suzanne Foster National Geographic Little Fr 27, 2012 Zac de wall The book of Crete Feb 10, 2012 Total Book 3 Student 1 8111 Bryson $15.00 Suzanne Foster 15.1 12 de wall $20.50 Total Books 5145.75 CSA The first table for each class has 3 columns . The first column is the student name. The name is padded with one space in the start and as many spaces as necessary after the name. The name is truncated after the 16th character . The second column is the title of the borrowed book truncated after the 35th character. So the column has to be 37 characters wide. That is it the book title is longer than 35 characters, the title is truncated to fit. . The third column is the due de Notice that the due date format is converted to mmm dd, yyyy with the month in letters Jan Feb Maret Finally, a line at the end of the first table should indicate the total number of borrowed books by the pupils of the case. The table should be formatted as ilustrated above. The second table for each class has 2 columns . The first column is the student name. The name is padded with one space in the start and as many spaces as necessary after the name. The name is truncated after the 16th character . The second columns 10 positions wide and contains the total amount due by that student for all books returned damaged or lost and that are unpaid. The amount should be formatted with 2 digits after the decimal point . Finally, a line at the end of the second table should indicate the total amount stil de by the pupils of that class In addition to the output file the same output should also be printed on the screen without the list of students but only the totals and should look liker Total books currently borrowed) Total out due for books $345.75 Class: 25 Class A Note that the sample output table is not exactly related to the input examples provided here. Indeed, the output depends on 4 input files. The input and sample output provided here are just examples to indicate the format of all of the files. You should create your own files and stick to the structure described here. The Tas vill evaluate your assignment with different input files Sick to what the customer has requested as format. Do not try to make it nicer or more practical", or anything else. This is what the customer wants General Guidelines In addition to making sure that your code runs property, we will also check that you follow good programming practices. For example, divide the problem into smaller sub-problems and write functions to solve those sub-problems so that each function has a single purpose, use the most appropriate data structures for your algorithe use concise but descriptive variable names define constants instead of hardcoding literal values throughout your code indude meaningful comments to document your code, as well as doctrings for all functions and be sure to acknowledge any collaborates references in a leader comment at the top of your Python file Restrictions for this assignment you cannot use break continue and you cannot import any modules Doing so will result in deductions An acquaintance of yours, a librarian at an elementary school in a rural area who is still maintaining the library holdings manually on paper, has contacted you for assistance. They have acquired a computer and knowing that you are taking CMPUT 175, they have asked you to help write a program to automate some of the processes. Using a spreadsheet, they have already started collecting data that they can provide you in text- formatted files. Your python program would use these text-formatted files as input and produce as output lists that can be printed. The files that you have as input are as follows: The first file, books.txt, contains the list of all the books in the library. Each line of the file contains information about a book: Book ID followed by a pound (#), followed by a title, followed by a pound, followed by the author names, followed again by a pound and finally followed by a value in dollars. For example, the content of the file could look like this: B123456#The mouse and the motorcycle#Beverly Cleary B234587#Charlotte's Web#Elwyn Brooks White#15 B354759#Matilda#Roald Dahl#15 B654190#Harry Potter and the prisoner of Azkaban#Jo B58256#James and the giant peach#Roald Dahl#13 B246511#The witches#Roald Dahl#22 B998135#Pipi Longstocking#Astrid Lindgren#8.75 B100952#The battle of the labyrinth#Rick Riordan#25 The second file, students.txt, contains the list of students. Each line concerns one student and is formatted as follows: StudentID, student name, class, all separated by a comma (). For example, the content of the file could look like this: 5983342, Suzanne Foster, 2B 5981123, Eric Xu, 2B 5983342, Suzanne Foster, 2B 5981123, Eric Xu, 2B 5980127, Hua Li, 3A 5986654, Myriam Salah, 2A 5982234, Ali Rabbany, 3B 5987654, Kevin Kelly, 3A The third file, borrowers.txt, contains the history of all loans. Each line has a Book ID followed by a Student ID, followed by a date the book was borrowed, followed by the expected date the book is supposed to be returned. The dates are formatted in strings of 6 characters, the year followed by the month followed by the day. For instance the 5th of January 2022 would be "220105". This way dates can be compared. Indeed 220105 220131. All fields are separated by a semi column (:). For example the content of the borrowers.txt content could be like this: B123456;5983342;220105;220201 B234587;5983342;220110;220215 A fourth file, returns.txt, contains information about the returns. Each line has a Book ID followed by a Student ID, followed by a date the book was registered as returned, followed by the state of the book. The date is formatted as in the previous file YYMMDD and the state of the book is either "0" meaning the book is in good state, "1" if the book was lost,"2" if the book was lost and paid, "3" if the book was damaged and paid, otherwise it means the book was damaged and needs replacement but hasn't been paid yet. All fields are separated by a semi column (). Here is an example of how the file could look like: B123456;5983342;220201;0 B234587;5983342;220215;2 For all four input files, you can assume that there will not be whitespace at the beginning of each line, nor will there be blank lines in the file. You can also assume th 1 For all four input files, you can assume that there will not be whitespace at the beginning of each line, nor will there be blank lines in the file. You can also assume that all Book IDs used in borrowers.txt and returns.txt are defined in books.txt and all Student IDs in borrowers.txt and returns.txt are defined in students.txt. Your Python program must generate a file, standing.txt, that contains for each classroom two tables. The first table is listing all of the books that haven't been returned yet and the name of the borrower sorted by the borrowers name, with the due date. This table should only contain the books that haven't been returned. this information can be obtained from borrowers.txt and returns.txt. The due date is the date the book is supposed to be returned. The second table, also sorted by the students' names, contains the amount due by students. The student owes the cost of the book (from the books.txt file) if the book was lost (i.e. the state of the book is 1 in the returns.txt file) or was damaged but not paid back (i.e. status is not 0, 1, 2, or 3 in the returns.txt file). Both tables, as shown below, end with a total. In one case, it is the count of books borrowed by students in the classroom, and in the second case the total of money due by all students in the classroom. Class: 2B Student Name | Book | Eric Xu Suzanne Foster Suzanne Foster | Harry Potter and the prisoner Pipi Longstocking | National Geographic Little Kid | Zac de wall The Kids book of Canada | Total Books | Zac de wall The Kids book of Canada Total Books Student Name Due | Bill Bryson | Suzanne Foster 1 1 $15.00 $5.751 | Zac de Wall 1 $20.50 Total Books |$145.751 Class: A The first table for each class has 3 columns: The first column is the student name. The name is padded with one space in the start and as many spaces as necessary after the name. The name is truncated after the 16th character. The second column is the title of the borrowed book truncated after the 35th character. So the column has to be 37 characters wide. That is, if the book title is longer than 35 characters, the title is truncated to fit. The third column is the due date. Notice that the due date format is converted to mmm dd, yyyy with the month in letters Jan, Feb, Mar, etc. Finally, a line at the end of the first table should indicate the total number of borrowed books by the pupils of the class. The table should be formatted as illustrated above. The second table for each class has 2 columns: The first column is the student name. The name is The second table for each class has 2 columns The first column is the student name. The name is padded with one space in the start and as many spaces as necessary after the name. The name is truncated after the 16th character. The second column is 10 positions wide and contains the total amount due by that student for all books returned damaged or lost and that are unpaid. The amount should be formatted with 2 digits after the decimal point Finally, a line at the end of the second table should indicate the total amount still due by the pupils of that class. In addition to the output file, the same output should also be printed on the screen without the list of students but only the totals and should look like: Class: 2B Total books currently borrowed: 35 Total amout due for books: $145.75 Class: A ... Note that the example output table is not exactly related to the input examples provided here. Indeed, the output depends on 4 input files. The input and sample output provided here are just examples to indicate the format of all of the files. You should create your own files and stick to the structure described here. The TAs will evaluate your assignment with different input files. Stick to what the customer has requested as format. Do not try to make it "nicer" or "more practical", or anything else. This is what the customer wants. 1 Problem: Data Processing An acquaintance of yours, a librarian at an elementary school in a rural area who is still maintaining the library holdings manually on paper, has contacted you for assistance. They have acquired a computer and knowing that you are taking CMPUT 175, they have asked you to help write a program to automate some of the processes. Using a spreadsheet, they have already started collecting data that they can provide you in text-formatted files. Your python program would use these text-formatted files as input and produce as output lists that can be printed. The files that you have as input are as follows: The first file, books.txt, contains the list of all the books in the library. Each line of the file contains information about a book: Book ID followed by a pound (#), followed by a title, followed by a pound, followed by the author names, followed again by a pound and finally followed by a value in dollars. For example, the content of the file could look like this: B123456#The mouse and the motorcycle#Beverly Cleary#10.5 B234587#Charlotte's Web#Elwyn Brooks White#15 B354759#Matilda#Roald Dahl#15 B654190#Harry Potter and the prisoner of Azkaban#Joanne Rowling#25 B58256#James and the giant peach#Roald Dahl#13 B246511#The witches#Roald Dahl#22 B998135#Pipi Longstocking#Astrid Lindgren#8.75 DOST hahanda B998135#Pipi Longstocking#Astrid Lindgren#8.75 B100952#The battle of the labyrinth#Rick Riordan#25 The second file, students.txt, contains the list of students. Each line concerns one student and is formatted as follows: Studenti, student name, class, all separated by a comma (). For example, the content of the file could look like this: 5983342, Suzanne Foster, 2B S981123, Eric Xu, 2B 5980127, Hua Li, 3A $986654, Myriam Salah, 2A S982234, Ali Rabbany, 3B 5987654, Kevin Kelly, 3A The third file, borrowers.txt, contains the history of all loans. Each line has a Book ID followed by a Student ID, followed by a date the book was borrowed, followed by the expected date the book is supposed to be returned. The dates are formatted in strings of 6 characters, the year followed by the month followed by the day. For instance the 5th of January 2022 would be "220105". This way dates can be compared. Indeed 220105 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started