Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need this in Python and 4 functions for last 4 dots Standard sales amount are listed below for the first array. A store needs a

Need this in Python and 4 functions for last 4 dots

Standard sales amount are listed below for the first array.

A store needs a program to calculate the sales statistics for each department this year. The store has standard sales amount (in thousand dollars) for each month based on data in previous years.

Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec 23.0 33.1 21.0 23.5 54.0 34.3 35.0 45.0 56.3 45.6 34.0 55.0 

The monthly sales amounts for departments are stored in a file sales.dat. Every line in the file contains 12 sales amounts for that department. Write a program to calculate statistics for each department in the store. Your program should do the following:

  1. Store the standard sales amount in an array
  2. Read the sales amount for each department into a (second) parallel array
  3. Compute the average monthly sale for each department
  4. Compare each monthly sales amount with the standard and store the result in another (third) array of Boolean. The program will store true in the third array if the amount is larger than or equal to the standard and false otherwise.
  5. Use the third array to find out how many months are below standard and how many are above.
  6. Output the statistics for the department, including department number, average sales amount, numbers of months above and below standard, and performance. The program should output unsatisfactory as the performance of the department if more than four months are below standard and satisfactory otherwise.
  7. Keep processing each department until the end of the file.

Your program must include a single function for each of the following. You may use more functions or break these into multiple functions as needed or desired.

  • Given the array of sales amount, return the average sales amount.
  • Given the array of sales amount, compare with the standard array and enter comparison results in the third array.
  • Given the third array of Boolean, return the number of months in which the sales amounts are above standard.
  • Output a final statistics for each department.

sales.dat

23 33.5 21 23 25 56 54 43 34.2 35.4 34 69.5 24 35.2 24 26 43 56.7 54 32 43 34 34 57.9 24 42 43 35 52 56 67 54 56 45.3 32 32 20 32 45 72 45.4 63.2 45 56 52 65 53 65 34 35 37.5 32 23 45 31 43 52 43 76 65 35 56 63.4 45.2 45.6 56 67.3 45 56.3 67 78 76 34.2 45 62 19 45 39 38 37 82 74 45 58.4

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago