1. Setup your Python file lab3-2.py with an appropriate comments header. 2. Organize lab3-3.py using comments...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Setup your Python file lab3-2.py with an appropriate comments header. 2. Organize lab3-3.py using comments for each block of planned code. 3. Complete the readIt () function. 4. Complete the makeSeq () function. 5. Complete the lookup () function. 6. Complete the myMenu () function. 7. Complete the main () function. 8. Submit your completed lab3-3.py Python program to BrightSpace. Before you begin, download the data files posted on BrightSpace for this assignment. Problem Description: Stiles Publishing prints custom Computer Science textbooks for Big Ten universities. They store their textbook and course data in a text file which includes six fields: 1) SemesterID, 2) CourselD, 3) TextbookID, 4) Programming Language, 4) Enrollment and the 5) Course Instructor. An example of this data can be found in Table 1. The file provided (classBooks.txt) includes data from 75 courses with associated text books published for the summer 2017 (SU2017) through spring 2018 (SP2018) semesters. Note: The data in classBooks.txt has a fixed-width format, meaning each field starts at the same position on each line. SU2017 CS336 Q5504 Java FA2017 CS230 A6107 Python FA2017 CS338 23939 Python SU2018 CS221 P7956 Visual Basic FA2018 CS230 A6107 Python SU2018 CS173 K7877 с SP2018 CS190 R5803 MATLAB 118 A Chaturvedi 107 V Raskin 181 Y Charlie 166 C Nita-Rotaru 134 D Ebert 70 S Kais 224 B Benes Table 1: Example course textbook and enrollment data in a fixed-width format You have been assigned to develop an application to access this data for Stiles Publishing. Your assignment is to write a Python program file named exam3f.py including five (5) functions: readIt (): makeSeq (): lookup (): myMenu(): main (): Reads the data from the file and returns a List of values in a specific format Processes the data and creates a Dictionary summarizing each instructor's number of courses per semester. Searches the Dictionary for the courses for a given instructor Creates a Graphics window as an interface to allow the user to display an instructor's number of courses per semester and their total. Brings it all together into a single, functional program These functions work together to create a single graphical interface allowing Stiles Publishing to review summary information about their courses, textbooks and enrollment data. Detailed specifications for each function can be found in the instructions on the following pages. Part 1: Setup Your lab3-3.py Python File In the Python IDLE editor, open a new program window. At the top of the file, create an appropriate program header including the program name, your name and a short description of the program. Part 2: Organize lab3-3.py using comments There are several parts to this lab including writing multiple functions. Even within these functions, you might be able to divide the task into further smaller subtasks. We leave it to your discretion to identify these subtasks as they are necessary. Below your program header, enter additional comments in your Python program identifying each part, function and subtask. Make sure to leave blank spaces between each comment section. In your finished program, there will be comments before any lines of code to make them easier to understand. Part 3: Complete the readIt() function Write a function named readIt () that accepts one (1) argument, a String which represents a data file name, (examples of the data file are shown on in the Problem Description on page 2). The readIt () function completes the following tasks: Read the contents of the filename given in the argument into a List storing each line as a String Modify the List by splitting each element into a sub-List containing five Strings and an Integer original String element " SU2017 CS336 Q5504 Java 118 A Chaturvedi" sub-List with 5 Strings and 1 Integer ["SU2017", "CS336", "Q5504", "Java", 118, "A Chaturvedi"] ● • ● Strings ● Return the finished List Integer Part 4: Complete the makeSeq() function Write a function named makeSeq () that accepts one (1) argument, a List and completes the following tasks: Create a Dictionary using the instructor names from the List as keys Calculate the total number of courses for each instructor for each semesterID. The Dictionary values associated with each instructor key will be a List with five (5) Integer entries representing that instructor's total number of courses per semester in the following order: SU2017, FA2017, SP2018, SU2018 and FA2018 { "D Ebert": [0,2,0,3,1], "A Chaturvedi": [2,1,2,4,1] } Note: There are 13 instructors- this is just a sample of the actual Dictionary values Return the completed Dictionary Part 5: Complete the lookup () function Write a function named lookup () that accepts two (2) arguments, (a Dictionary and a String), and completes the following tasks: • If the String is not a key in the Dictionary, the lookup () function should return False • Using the String as the Dictionary key, retrieve the corresponding value. This will be a List containing five (5) Integers Create a new List containing each of the five (5) Integers as well as their numeric sum. • The lookup () function should return the new List. NOTE: The returned List will have six (6) values. ● Example: If a Dictionary is named myDict and has the key "A Chaturvedi" with the following value: >>> myDict ["A Chaturvedi"] [2, 1, 2, 4, 1] Calling the lookup () function, providing the Dictionary name and valid key would provide the result: >>> lookup (myDict, "A Chaturvedi") [2, 1, 2, 4, 1, 10] Where 10 is the numeric sum of the original five Integer values. Calling the lookup () function, providing the Dictionary name and misspelling the key: >>> lookup (myDict, "A Chatrvdi") False Part 6: Complete the myMenu() function Write a function named myMenu () that accepts one (1) argument, (a Dictionary), and completes the following tasks: • If a mouse click is detected in the green LOOKUP control the String in the Instructor Name: Entry box is retrieved and passed along with the Dictionary to the lookup () function. ● ● Creates a 300 x 400 Graphic window that matches the example in Figure 1 including an Entry box object labeled Instructor Name: and two Rectangles with the labeled LOOKUP and QUIT. The LOOKUP Rectangle should have a green fill color and the QUIT should be red. Create the Rectangles and Text labels shown for each semester and total as shown in Figure 1. ● ● The entries in the List returned by the lookup () function are used to populate the enrollment Text boxes for SU2017, FA2017, SP2018, SU2018, FA2018 and Total. If the lookup () function returns a value of False, assume an invalid name was entered in the Instructor Name: Entry box. Set the enrollment Text entries for SU2017, FA2017, SP2018, SU2018, FA2018 and Total to "" empty Strings If a click is detected in the red QUIT control, the Graphic window is closed and the program ends. Stiles Publishing Course Enrollment Summary Instructor Name: LOOKUP SU2017 FA2017 SP2018 SU2018 FA2018 TOTAL Part 7: The main () function: Write a function named main() that completes the following tasks: Figure 1: Graphic window created by myMenu() function QUIT Calls the readIt () function to read the file and store the data in a List Calls the makeSeq () function to create the Dictionary Calls the myMenu () function to present the user with the Graphical menu 1. Setup your Python file lab3-2.py with an appropriate comments header. 2. Organize lab3-3.py using comments for each block of planned code. 3. Complete the readIt () function. 4. Complete the makeSeq () function. 5. Complete the lookup () function. 6. Complete the myMenu () function. 7. Complete the main () function. 8. Submit your completed lab3-3.py Python program to BrightSpace. Before you begin, download the data files posted on BrightSpace for this assignment. Problem Description: Stiles Publishing prints custom Computer Science textbooks for Big Ten universities. They store their textbook and course data in a text file which includes six fields: 1) SemesterID, 2) CourselD, 3) TextbookID, 4) Programming Language, 4) Enrollment and the 5) Course Instructor. An example of this data can be found in Table 1. The file provided (classBooks.txt) includes data from 75 courses with associated text books published for the summer 2017 (SU2017) through spring 2018 (SP2018) semesters. Note: The data in classBooks.txt has a fixed-width format, meaning each field starts at the same position on each line. SU2017 CS336 Q5504 Java FA2017 CS230 A6107 Python FA2017 CS338 23939 Python SU2018 CS221 P7956 Visual Basic FA2018 CS230 A6107 Python SU2018 CS173 K7877 с SP2018 CS190 R5803 MATLAB 118 A Chaturvedi 107 V Raskin 181 Y Charlie 166 C Nita-Rotaru 134 D Ebert 70 S Kais 224 B Benes Table 1: Example course textbook and enrollment data in a fixed-width format You have been assigned to develop an application to access this data for Stiles Publishing. Your assignment is to write a Python program file named exam3f.py including five (5) functions: readIt (): makeSeq (): lookup (): myMenu(): main (): Reads the data from the file and returns a List of values in a specific format Processes the data and creates a Dictionary summarizing each instructor's number of courses per semester. Searches the Dictionary for the courses for a given instructor Creates a Graphics window as an interface to allow the user to display an instructor's number of courses per semester and their total. Brings it all together into a single, functional program These functions work together to create a single graphical interface allowing Stiles Publishing to review summary information about their courses, textbooks and enrollment data. Detailed specifications for each function can be found in the instructions on the following pages. Part 1: Setup Your lab3-3.py Python File In the Python IDLE editor, open a new program window. At the top of the file, create an appropriate program header including the program name, your name and a short description of the program. Part 2: Organize lab3-3.py using comments There are several parts to this lab including writing multiple functions. Even within these functions, you might be able to divide the task into further smaller subtasks. We leave it to your discretion to identify these subtasks as they are necessary. Below your program header, enter additional comments in your Python program identifying each part, function and subtask. Make sure to leave blank spaces between each comment section. In your finished program, there will be comments before any lines of code to make them easier to understand. Part 3: Complete the readIt() function Write a function named readIt () that accepts one (1) argument, a String which represents a data file name, (examples of the data file are shown on in the Problem Description on page 2). The readIt () function completes the following tasks: Read the contents of the filename given in the argument into a List storing each line as a String Modify the List by splitting each element into a sub-List containing five Strings and an Integer original String element " SU2017 CS336 Q5504 Java 118 A Chaturvedi" sub-List with 5 Strings and 1 Integer ["SU2017", "CS336", "Q5504", "Java", 118, "A Chaturvedi"] ● • ● Strings ● Return the finished List Integer Part 4: Complete the makeSeq() function Write a function named makeSeq () that accepts one (1) argument, a List and completes the following tasks: Create a Dictionary using the instructor names from the List as keys Calculate the total number of courses for each instructor for each semesterID. The Dictionary values associated with each instructor key will be a List with five (5) Integer entries representing that instructor's total number of courses per semester in the following order: SU2017, FA2017, SP2018, SU2018 and FA2018 { "D Ebert": [0,2,0,3,1], "A Chaturvedi": [2,1,2,4,1] } Note: There are 13 instructors- this is just a sample of the actual Dictionary values Return the completed Dictionary Part 5: Complete the lookup () function Write a function named lookup () that accepts two (2) arguments, (a Dictionary and a String), and completes the following tasks: • If the String is not a key in the Dictionary, the lookup () function should return False • Using the String as the Dictionary key, retrieve the corresponding value. This will be a List containing five (5) Integers Create a new List containing each of the five (5) Integers as well as their numeric sum. • The lookup () function should return the new List. NOTE: The returned List will have six (6) values. ● Example: If a Dictionary is named myDict and has the key "A Chaturvedi" with the following value: >>> myDict ["A Chaturvedi"] [2, 1, 2, 4, 1] Calling the lookup () function, providing the Dictionary name and valid key would provide the result: >>> lookup (myDict, "A Chaturvedi") [2, 1, 2, 4, 1, 10] Where 10 is the numeric sum of the original five Integer values. Calling the lookup () function, providing the Dictionary name and misspelling the key: >>> lookup (myDict, "A Chatrvdi") False Part 6: Complete the myMenu() function Write a function named myMenu () that accepts one (1) argument, (a Dictionary), and completes the following tasks: • If a mouse click is detected in the green LOOKUP control the String in the Instructor Name: Entry box is retrieved and passed along with the Dictionary to the lookup () function. ● ● Creates a 300 x 400 Graphic window that matches the example in Figure 1 including an Entry box object labeled Instructor Name: and two Rectangles with the labeled LOOKUP and QUIT. The LOOKUP Rectangle should have a green fill color and the QUIT should be red. Create the Rectangles and Text labels shown for each semester and total as shown in Figure 1. ● ● The entries in the List returned by the lookup () function are used to populate the enrollment Text boxes for SU2017, FA2017, SP2018, SU2018, FA2018 and Total. If the lookup () function returns a value of False, assume an invalid name was entered in the Instructor Name: Entry box. Set the enrollment Text entries for SU2017, FA2017, SP2018, SU2018, FA2018 and Total to "" empty Strings If a click is detected in the red QUIT control, the Graphic window is closed and the program ends. Stiles Publishing Course Enrollment Summary Instructor Name: LOOKUP SU2017 FA2017 SP2018 SU2018 FA2018 TOTAL Part 7: The main () function: Write a function named main() that completes the following tasks: Figure 1: Graphic window created by myMenu() function QUIT Calls the readIt () function to read the file and store the data in a List Calls the makeSeq () function to create the Dictionary Calls the myMenu () function to present the user with the Graphical menu
Expert Answer:
Answer rating: 100% (QA)
Answer Here is the completed lab33py Python program with the requested functions lab33py Author Question AI This program allows Stiles Publishing to a... View the full answer
Related Book For
Posted Date:
Students also viewed these accounting questions
-
A computer science professor has seven different programming books on a bookshelf. Three of the books deal with C++, the other four with Java. In how many ways can the professor arrange these books...
-
An achievement test in a beginning computer science course was administered to two groups. One group had had a previous computer science course in high school; the other group had not. The test...
-
Your instructor will show you how to create data files using the software for your course. Use it to create the data file you constructed by hand in Exercise 1.17 or 1.18.
-
Discuss the impact of commissions in organizations growth?
-
Hosbach Manufacturing produces a variety of plastic containers using an extrusion blow molding process. The following activities are part of Hosbach Manufacturings operating process: 1. A plant...
-
Three areas of southern California are prime candidates for forest fires each dry season. You believe (based on historical evidence) that each of these areas, independently of the others, has a 30%...
-
You have been asked by the prospective directors of a shortly to be established business what is meant by ordinary shares, preference shares and debt capital. Further, you have been asked to provide...
-
At the end of its first year of operations on December 31, 2010, KAT Companys accounts show the following. The capital balance represents each partners initial capital investment. Therefore, net...
-
For an acute myocardial infarction and function is the manifestation acute indicates episode of care and myocardial indicates the general side of the infarction
-
Your marketing research firm is preparing the final written report on a research project commissioned by a major manufacturer of lawn mowers. One objective of the project was to investigate seasonal...
-
An analyst gathered the following data about a company: A historical dividend payout ratio of 40% that is projected to continue into the future. A sustainable return on equity of 10%. A beta of...
-
Accounting Fraud at Tesco Stores (C) 1.What factors led to the accounting issue? Who do you think is responsible for the accounting issue? 2.What are your recommendations to Dave Lewis on how to...
-
A division is considering the acquisition of a new asset that will cost $2,860,000 and have a cash flow of $700,000 per year for each of the four years of its life. Depreciation is computed on a...
-
Discuss the principles of population genetics and the mechanisms driving genetic variation within and between populations, including genetic drift, gene flow, mutation, and natural selection, and...
-
An important aspect of banking regulation is capital adequacy regulation. Capital adequacy regulation is particularly important because deposit insurance and other elements of the federal safety net...
-
1. Verify that the eigenvalues of A are: 2. (3 points) Verify that If these numbers look familiar, it's because A is called the Golden Ratio, often denoted by y, and A is 1 - p, or p. H 3. (6 points)...
-
Binary tree algorithms can be complicated: Are they worth the effort? Recall the characteristics of sort algorithms that use a binary divide and conquer technique. If each node of a tree is large...
-
Independent random samples of sizes n1 = 30 and n2 = 50 are taken from two normal populations having the means 1 = 78 and 2 = 75 and the variances 21 = 150 and 22 = 200. Use the results of Exercise...
-
The following data were collected on the study of the relationship between a companys retail sales and advertising dollars: Retails Sales ($) .... Advertising ($) 29,789 ........ 16,893 35,434...
-
Develop a level aggregate plan for the Draper Company if no back orders are permitted. (a) Show what would happen if this plan were implemented. (b) Calculate the costs associated with this plan. (c)...
-
The owners of Speedy Logistics, a company that provides overnight delivery of documents, are considering where to locate their new facility in the Midwest. They have narrowed their search down to two...
-
Briefly describe the concept of weighted average cost of capital.
-
A company plans to accumulate 75% of its needed investment capital by issuing bonds having a capital cost percentage of 12%; the balance will be raised by issuing stock having a capital cost...
-
In what sense does the cost of capital limit a firms investment considerations?
Study smarter with the SolutionInn App