Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your program should produce a report that indicates: The date, time, price, category, and rating of the sale with the highest and lowest per
Your program should produce a report that indicates: The date, time, price, category, and rating of the sale with the highest and lowest per unit price. In case of multiple transactions with the same price, it COMP 210 DSA - Fall 2022 - Assignment 2. 2 should report the transaction that comes later in the input (not necessarily later by date, but simply later as provided to the program at entry). The quantity, average price, rating, and duration of sales by category. Important notes: The average price is a weighted average that needs to consider the quantity of sold items per transaction. The average rating and duration are the average ratings and average duration among all the concerned users, which does not consider the quantity of sold items. Here is what your output should exactly look like (including decimal places) for the above input: Highest per unit sale: When: 4/7/22 20:45 Category: phone Price: 1699.00 Rating: 5.0 Lowest per unit sale: When: 5/19/22 07:16 Category: book Price: 15.50 Rating: 3.0 Averages by book Quantity: 13 Price: 74.73 Rating: 3.55 Duration: 8.50 Averages by jewelry Quantity: 1 Price: 1699.00 Rating: 3.50 Duration: 19.00 Averages by phone Quantity: 57 Price: 788.78 Rating: 4.50 Duration: 6.00 Part B. Write a program to process information about online shopping data. 1. Requirements for your program. Your program will create a database of sales for a small store that sells various categories of merchandise such as books, jewelry, phones, etc. It will have a series of entries representing transactions in this store. You will initially be asked to enter some sample entries and subsequently the program should output some statistics of the entries. The program will work as follows: Where: The first input will be an integer that indicates how many transactions will be entered in the database. Following this will be information about each transaction on a single line with the following form: MM/DD/YY, HH:MM, Category, Price, Quantity, Rating, Duration MM/DD/YY represents the date of transaction. HH:MM represents the transaction time in hours and minutes in 24-hour format. Category represents a single word descriptor of the category of sold item. Following 3 types of categories must be supported and may be predefined in an array: "phone", "jewelry" and "book". Price is the per unit price of the sold item (e.g. $189.50). Quantity represents the number of items sold in this transaction (e.g. 12). Rating represent the rating by the user of the sale on a scale of 0.0-5.0. Duration is an integer that represents the number of days it took to deliver the item to the user. Here is an example of what your input might look like: 6 10/15/21 17:00 phone 85.50 12 4.0 8 11/24/21 13:30 phone 959.90 44 4.5 7 3/18/22 1:16 jewelry 1699.00 13.5 19 4/7/22 20:45 phone 1699.00 1 5.0 3 5/17/22 23:45 book 85.50 11 4.1 5 5/19/22 07:16 book 15.50 2 3.0 12 The quantity, average price, rating, and duration of sales by category. Important notes: The average price is a weighted average that needs to consider the quantity of sold items per transaction. The average rating and duration are the average ratings and average duration among all the concerned users, which does not consider the quantity of sold items. Here is what your output should exactly look like (including decimal places) for the above input: Highest per unit sale: When: 4/7/22 20:45 Category: phone Price: 1699.00 Rating: 5.0 Lowest per unit sale: When: 5/19/22 07:16 Category: book Price: 15.50 Rating: 3.0 Averages by book Quantity: 13 Price: 74.73 Rating: 3.55 Duration: 8.50 Averages by jewelry Quantity: 1 Price: 1699.00 Rating: 3.50 Duration: 19.00 Averages by phone Quantity: 57 Price: 788.78 Rating: 4.50 Duration: 6.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
PART A To write the program to produce the desired output you can follow these steps 1 Parse the input data containing information about sales transactions 2 Iterate through the sales transactions to ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started