Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

urgent (python) Problem 3. Sales File We have a file called probSales.txt that contains information about 7 employees and their monthly sales for one year.

urgent (python) image text in transcribed
Problem 3. Sales File We have a file called "probSales.txt" that contains information about 7 employees and their monthly sales for one year. Each line in the file contains the last name of an employee followed by 12 values (monthly sales) and they are all separated by spaces. We want to compute the average sale for each employee and display on screen the information about the employees, their sales, their average sales, and then display on screen the highest average. a) Define two lists of size 7, called "names" and "average Sales" to hold the names and averages of the 7 employees, respectively. b) Write a program where you do the actions listed below. You can test your program with the file available on Moodle. c) Open the file "probSales.txt" d) Write a function that reads the information about the employees, one line at a time. For each line, store the last name in "names", display the information of the employee on screen, compute the average sales, display it on screen and store it in the array "averageSales". e) Write a function that takes "average Sales" as a parameter and returns the index of the highest average value. f) Display on screen the last name of the employee with the highest average sale followed with his average sale. A sample of the file probSales.txt is shown below: Zakka 500.41 684.67 744.64 557.05 Fakih 732.81 \646.04 Alan 502.92 623.82 615.38 Soubra 756.67 762.99 546.64 651.41 Safaoui 782.53 568.68 775.29 Ojeimi 623.16 530.35 726.48 774.46 Hani 658.90 567.29 740.84 668.27 . 539.02 518.69 597.41 626.23 For this sample file, the output on the screen would be: Name:Zakka Sales: 500.41 684.67 563.34 765.00 691.69 657.24 614.78 793.58 769.62 744.64 557.05 781.45 Average sales: 676.96 Name:Fakih Sales: 732.81 668.27 599.61 504.91 529.95 619.42 548.27 554.36 823.91 646.04 539.02 501.53 Average sales: 605.67 The employee with the highest average sale is: Soubra: 698.54 condan

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

Step: 3

blur-text-image

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago