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

  Compute and out put turnaround time and wating time

The program should compute and out put turnaround time and wating time of every job as well as the average waiting time and average turnaround time.

  What three properties characterize lists

What does it mean to say that the Delete operation is ambiguous? What three properties characterize lists? How were we able to make the list generic?

  Write a program that can be used to design a suburban scene

Write a program that can be used to design a suburban scene, with houses, streets, and cars. Users can add houses and cars of various colors to a street.

  Find whether the year entered from the keyboard

create a C program to determine whether the year entered from the keyboard is a leap year. Display a message indicating whether the year is or is not a leap year.

  It will calculate the additional amount of sales that each

modifynbspthe week three javatm application using javatm netbeanstm ide to meet these additional and changed business

  Solves a system of linear equations

Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination.

  Create a program that allows user to input a launch velocity

Create a program that allows the user to input a launch velocity from the surface of Halley's Comet and determine whether a jumper will return to the surface.

  Write a method which will accept two parameters

Write a method which will accept 2 parameters. Each parameter is an array of doubles. The arrays are of equal length.

  Create a new program to prepare a sequence

Follow the steps of Allen-Bradley Programming Procedures to create the program demonstrated: A+,A-.

  Calculate the sum of the numbers from one to n

Write an assignment statement to calculate the sum of the numbers from 1 to N using Gauss's formula

  Write a javascript program to make change

You should use prompt() to read a string and parseInt() to convert the string into an integer number of cents (i.e. fractions of a dollar).

  Distinguish between instruction register and program counter

Distinguish between the IR (instruction register) and the PC (program counter). Where is the data (operand) if the address mode specifier is a. 00 b. 01.

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