Structs
Useful links
orders.csvfile with information about orders. It contains purchase entries:- buyer’s email
- name of the item
- item quantity
- date of the purchase.
- A sample program that processes
orders.csv.
Exercises
Exercises 0a, 0b, and 0c are implemented in the sample program attached above.
- Write a program that opens
orders.csv, reads it and transforms into a struct. Bonus points for storing a purchase date astime.Timein the struct.
0b. Find a buyer (or buyers) with most purchases. Home many unique items did the buyers buy?
0c. Calculate statistical metrics about sales: min, mean, and max number of sold items?
-
How many unique buyers are there?
-
How many unique items were sold? Print all the items.
-
Is there at least one buyer that purchased the same item in different days?
-
Calculate the total number of buyers for each item.
-
Write a function that, given a buyer’s email, prints all items that they bought.
-
What is the most popular day of the week?
-
For each buyer, generate a file that contains all items that they bought. Each name should be named as
<email>.txtwith@replaced by.. E.g. a file foruser@gmail.comshould be calleduser.gmail.com.txt.