Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help with this project, the solution should be in python, all the details are listed in the images, and the file thats

Hi, I need help with this project, the solution should be in python, all the details are listed in the images, and the file

thats needed for the project is underneath the images

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

SHOPPING CART CALCULATIONS Get started with the project by addding the data to your repo First of all, please download this data in this file and add it to your repo. Your code is going to have to read this data structure. If you look at the data you'll see that what we have is a list or array of elements. Each element represents a shopping basket. Each shopping basket has a few different pieces: 1. email: this is the email address of the customer 2. status: this can have a few different values: 1. OPEN means that the person is still busy shopping 2. PAID means that the person has paid for the basket in full, they are waiting for delivery 3. DELIVERED means that the customer has paid for and received their stuff 3. items: this is a list/array of all the things that a person added to the basket Each item in the shopping basket has a few properties of its own: 1. name: dah 2. quantity: how many of these does the person want to buy? 3. price: This is the price of a single item. The prices are in South African Rands For example if there is an item in the shopping cart that looks like this: { "name": "hamster", "quantity": 2, "price": 20} Then it means that the person is buying 2 hamsters at a price of R20 each. So that's R40 in total. Please note that one person can have multiple baskets. If you look at the data, you'll see that tshepo@umuzi.org has 4 baskets. Two have been delivered, one has been paid for (so he's awaiting delivery) and one is open (so he's setting up his next order). Wr some functionality get baskets belonging to a single customer Write a function called get customer baskets that has an email address as an argument and returns a list/array of all the shopping baskets that belong to the customer with that email address, If the customer has no shopping baskets then return an empty list/array. get a list of all the customer email addresses Write a function called get all customers that returns a list of customer email addresses. The list must have no duplicates. list all the items that have been paid for but not yet delivered Write a function called required stock that gets all the items that need to be sent out to delivery. You need to return data in the correct format. Just include the names and quantities of the items. Eg: if one customer paid for 2 hamsters and another customer paid for one hamster and a bag of sawdust then your function should return the following data structure: [ "name": "hamster", "quantity": 3}, { "name": "bag of sawdust", "quantity" 1} ] Get the total amount spent by a customer Write a function called total spent that takes an email address as an argument The function must return the total amount that the customer has spent up until this time. Note that if a basket has been delivered then it has been paid for. Top customers Write a function called top customers that returns a list/array of all the customers. The result should be ordered according to total amount spent. The returned data structure should be an array/list of dictionaries/objects showing the email addresses and the total amounts spent per customer. Make sure the returned value matches the following structure: [ { "email": "tshepo@muzi.org", "total": 1823.10}, { "email": "maru@email.com", "total":950}, ... etc ] Hint: You have already defined some functions that would be useful in finding this result. Call those functions. customers who have OPEN baskets Write a function called get customers with open baskets that returns a list/array of email addresses for customers who have baskets that are open. Notes to reviewers the code must be DRY there can be some global constants to help prevent typos. eg const DELIVERED="DELIVERED" functions are supposed to return very specific things

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

Which of these influenced your life most dramatically?

Answered: 1 week ago

Question

What roles have these individuals played in your life?

Answered: 1 week ago