Create a few summary analyses of the data

Assignment Help Computer Engineering
Reference no: EM132383911

Programming Assignment

Getting started

Complete the reading and practice assignments posted on the course schedule. Review class handouts and examples. This assignment requires knowledge of loops, lists and function definitions.

Programming Project: OrderSummary

Create an order summary matrix.

In this assignment you will be processing order data from a fictional coffee shop. The café's owner would like to optimize the business operations and has hired you to create a few summary analyses of the data. The first task concerns determining how many employees are needed in the shop at different times, for which the owner would like to see how many orders came within each hour of the work day.

The data, collected from online and in-person orders, includes a set of uniform records, each storing the following fields

• Date and time of the order. The date ranges over all dates of August, 2019. The time range of orders corresponds to the working hours of the business, which is 6 am until midnight.

• First and last name of the person making the order, if known. 'anon' represents orders by anonymous customers.

• Number of items ordered for each of the following products: espresso, cappuccino, americano, pastry, muffin, scone.

The data is supplied in a file, orderlog.py, which is posted with the assignment. For simplicity,
orderlog.py
contains a definition of a python list, stored in variable called orderlst, as follows:
orderlst=[
['datetime', 'first name', 'last name', 'espresso', 'cappuccino', 'americano', 'pastry', 'muffin', 'scone'],
['2019-08-03 09:05:54', 'anon', 'anon', 0,1,1,3,0,4],
['2019-08-06 10:17:17', 'Jacquelin', 'Trevale', 0,2,1,3,1,0],
['2019-08-21 12:33:23', 'Zuleyma', 'Pemdevon', 2,2,2,3,2,1],

. . . the rest of the content is omitted . . .
]

As you can see from the above, orderlst is a two-dimensional list, in which the first row represents column titles, and each of the rest of the rows represents a single order, stored as a list. The inner lists have the same structure, listing values of the fields described in the first row, as shown.

To use the orderlst list in your program, download orderlog.py in your project folder and include the following code in the beginning of your program:

import orderlog
ORDERS = orderlog.orderlst # rename for brevity

This will make the orderlst content available to the program through the ORDERS global variableThe program that you write must work as follows.

1. Ask the user

a. how many days of data to summarize,

b. the length (in minutes) of the time interval used to aggregate the number of orders.

2. Create and display the order summary matrix, summarizing how many orders were placed during each interval starting from 6 am and ending at midnight, for each day starting from the first of the month until the day number, provided by the user in step 1. Recall, that each row in the ORDERS list represents one order.

3. Ask the user to specify the date, for which a histogram will be displayed. The histogram displays each order as one * symbol. If the user enters a number that falls beyond the range from 1 to the number of days in the summary matrix, the program should just repeat step 3 (as shown in the interaction below). Repeat step 3, until -1 is entered.

Important Notes and Requirements:

1. Your program should not use any global variables except for

a. ORDERS,

b. variables defining the opening and closing times (6am and 24am, expressed in minutes)

2. You must define and use the following functions, plus define and use others as you see fit:

a. function main(), to start the program flow, read user input and call other methods as needed.

b. function labelString () that will produce a string label shown in the leftmost column of the output. The function will be passed the interval number, opening time, and the length of the time interval as input parameters and must return a string defining the start and end time of the interval, as shown in the sample interaction. For example, to generate the second value ('7:00 - 7:59') in the leftmost column shown in the interaction, the function should be called as labelString(1, 6*60, 60 ).

c. function composeOrderMatrix(), with two parameters: the number of days, with a default value of 31, and the length of the interval in minutes, defaulting to 60. The method should create and return a two-dimensional list, representing the order summary matrix shown in the interaction as the shaded part of the order summary display. In the matrix, each column c will represent one day's data for day number (c+1). Values in row r will represent the number of orders in the time interval number r+1 from the beginning of the day.

First, create the two-dimensional list populated with as many rows of 0s, as the number of time intervals that would fit in the work day (must be calculated). The length of each row must equal to the number of days. Then, fill the matrix with values based on the ORDERS list and return the matrix populated with numbers of total orders.

d. function printOrderSummaryMatrix(), with two parameters: a two-dimensional list of integers and the length of the time interval. The function should display the content of the matrix as shown in the interaction, with the exact formatting.

e. function printHistogram(), which accepts three parameters: a two-dimensional list storing matrix values, the day number (1-based) and the length of the time interval. The function must display a histogram, as shown twice in the interaction above for column values 1 and 10. The histogram visualizes the numbers from the appropriate column of the matrix using * symbols.

Thus, when passed the order summary matrix and a day number, each * represents a single order placed in the consecutive time periods, as designated on the left of the histogram.

So, for example, the first histogram in the interaction corresponds to orders in day 1, so the first row displays 22 stars, the second - 19, and so forth.

3. There should be no code outside of function definitions, except for the definitions of the three global variables and a call to method main.

Reference no: EM132383911

Questions Cloud

What about the eurodollar or offshore dollar system : What about the Eurodollar or offshore dollar system makes the Federal Reserve worry about the efficacy of their own monetary policy?
Different characteristics of the bloomberg barclays : Please describe three different characteristics of the Bloomberg Barclays US Aggregate bond index.
Stage of the business cycle : What does yield curve inversion mean with regards to the stage of the business cycle? Why does a yield curve invert during this stage of the cycle?
Please describe all the cashflows of a us treasury security : Please describe all the cashflows of a US Treasury security, issued with 3 year maturity and a coupon of 2%.
Create a few summary analyses of the data : You will be processing order data from a fictional coffee shop. The café's owner would like to optimize the business operations and has hired you to create.
What is the effective annual rate of interest : If loan payments are made monthly and interest is compounded monthly, what is the effective annual rate of interest?
What is the most that you would pay for an investment : What is the most that you would pay for an investment that promises to pay $20,712 a year forever with the first payment starting one year from now?
What is the loan payment : a) What is the Loan Payment? b) What portion of this payment is Interest? c) What portion of this payment is Principal?
Which risk factors would be among your top priorities : Which risk factors would be among your top two or three priorities for this patient, and what interventions or recommendations would you provide for modifying.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd