Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COSC 1336 Python Page 1 of 5 Use the course material located at: o COSC 1336 Program 7 can be completed using content from the

image text in transcribedCOSC 1336 Pythonimage text in transcribed Page 1 of 5 Use the course material located at: o COSC 1336 Program 7 can be completed using content from the following chapters: o Welcome! through Functions Requirements (remember to identify the requirements by number): Create a file using PyCharm. Name the source file program_7.py. Format code like the examples. Include comments in your code like the examples. Code the requirements in the numbered list below. Output a header in the console: This is Program 7 Page 2 of 5 Requirements to be numbered in program_7.py: Write a program for a Honda regional office manager. Note: There is no data hard-coded in the program except for the two tuples. All data is entered by the user. See the code example at the end of this document. The requirements for Program 7 are very similar to those of Program 6. The only difference is that each of the functional actions (the numbered requirements) below must be put in a function and called from within the main() function. If you do not understand this, contact your professor. For example, in the following code sample, the function create_tuples() is called from main() to create the tuples described in step 2 below: COSC 1336 Program 7 Page 3 of 5 1. Print This program practices working with lists, strings, tuples, and dictionaries. 2. Create two tuples - one for two weeks named Week One and Week Two and one for three days of the week (Thursday, Friday, Saturday). 3. Use a loop to record the first name and last name of sales people in one string (e.g. Bill Simms) and the name of the dealership where they work in another string (e.g. Hero Honda). 4. In each iteration of the loop, create a dictionary entry for the salesperson data entered where the name is the key and the dealership is the value. 5. After populating dictionary, create two nested loops to process sales data. 6. The outer loop uses the weeks tuple and the inner loop uses the days tuple. 7. In the inner loop, ask the user to enter the number of cars sold by salesperson (display the salespersons name to the user). Store the users response in a list of sales data. For each salesperson, there should be six entries in the list. 8. Use a loop to have the user populate a list of 20 customer compliments. Why 20? It is just a number for testing. Include sales rep names in each of the compliments. 9. Use nested loops to process the customer compliments. The outer loop cycles through the sales reps and the inner loop cycles through the compliments. Use a sequence operation to search for each sales reps name in each of the compliments. For instance, the outer loop is set to the first sales rep. The inner loop searches for the sales reps name (the key in the dictionary) in compliment one, then compliment two, etc. Record the number of compliments associated with each sales rep. More on the compliments section: - User enters a compliment - The compliments include the sales rep names - After collecting all compliments - Will need nested loops (outside loop for each sales rep; inner loop for each compliment) - Search for the name of each sales rep in each compliment - Count the number of times you find a compliment for each sales rep COSC 1336 Program 7 Page 4 of 5 At the end of the program, produce output like that below for each of the sales reps processed. 10. All data is based on user entry (except tuples). Sample output: Bill Simms of Hero Honda Cars Sold Week One Thursday: 3 Friday: 4 Saturday: 7 Week Two Thursday: 5 Friday: 8 Saturday: 9 Total Cars Sold (per rep): _____ Average Cars Sold (per rep): _____ Number of Compliments (per rep): _____ 11. Print a statement explaining your experiences with Program 7. TEST TEST TEST your application to ensure the specific program requirements are met. Use the list above and the common requirements as a confirmation checklist. Not meeting all requirements = 0 points for the assignment. There should be a report like that shown at the END of the program that displays sales data for each of the sales reps. COSC 1336 Program 7 Page 5 of 5 Code example: Note: This is NOT the solution. However, it should be VERY helpful if you have questions about how to implement program_7.

The requirements for Program 7 are very similar to those of Program 6. The only difference is that each of the functional actions (the numbered requirements) below must be put in a function and called from within the "main()" function. If you do not understand this, contact your professor. For example, in the following code sample, the function create_tuples() is called from main() to create the tuples described in step 2 below: program-7.py # Create and return weeks and days tuples def create tuples (): 2 weeks_tuple-"Week One, Week Two) days-tuple = ( ' Thursday' , ' Friday' , ' Saturday' ) return weeks_tuple, days_tuple # main() function def main): 9 # Call the function createtuples() which will # return the two tuples created weeks, days create tuples() print (weeks, days) 10 - 12 13 14 15 16 17 18 19 20 21 # Determine if program is run as the ma in or a module if name main # This program is being run as the main program main ) else: 23 24 25 pass # Do nothing. This module has been imported by another # module that wants to make use of the functions, # classes, and/or other items it has defined Page 2 of 5 The requirements for Program 7 are very similar to those of Program 6. The only difference is that each of the functional actions (the numbered requirements) below must be put in a function and called from within the "main()" function. If you do not understand this, contact your professor. For example, in the following code sample, the function create_tuples() is called from main() to create the tuples described in step 2 below: program-7.py # Create and return weeks and days tuples def create tuples (): 2 weeks_tuple-"Week One, Week Two) days-tuple = ( ' Thursday' , ' Friday' , ' Saturday' ) return weeks_tuple, days_tuple # main() function def main): 9 # Call the function createtuples() which will # return the two tuples created weeks, days create tuples() print (weeks, days) 10 - 12 13 14 15 16 17 18 19 20 21 # Determine if program is run as the ma in or a module if name main # This program is being run as the main program main ) else: 23 24 25 pass # Do nothing. This module has been imported by another # module that wants to make use of the functions, # classes, and/or other items it has defined Page 2 of 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago