Search for question
Question

Assignment Problem Statement Assignment 3: Part 1 - Online Grocery An online grocery is a grocery store that allows the customers to order grocery items online and then the order can be either collected by the customer or delivered to the customer address. You are going to create a program that simulates the ordering system from an online grocery. Questions for Part 1: Q1- Create the items data structure: Create the (Grocery) data structure with at least 20 items. Each item is a separate data structure with its details: item number(id), item name, item price,** quantity** in stock. For example: [{"Milk":["001139801",10,20]}, {}, {}] OR [[001139802,"Milk”, 10,20], [ ], [ ]] (Note: the selection off the data structures is up to you, the above are just examples) Q2-Ordering: 1. ** Display** y** all items, each item with its price, to allow the customer to decide what to buy. 2. The customer has to enter the item name and the quantity of each item he/she wants to buy. And your code must validate that the item name is in the (Grocery) data structure and also validate the quantity. 3. The customer can continue ordering by typing the item name and quantity until he/she types pay. 4. If the customer orders an item; the quantity in the (Grocery) data structure must be reduced according to the user ordered quantity. 5. If the customer tries to order an item that is out of stock, display a message that the item is out of stock and DON'T add the item to the (Order) data structure. 6. If the item name entered and quantity entered by the customer are ok after all validations, then the item name, ** unit** price, entered** quantity and the calculated price** according to the entered quantity will be saved in the (Order) data structure. Q3 - Payment and Invoice: 1. The program must calculate the total bill amount. 2. The program will ask the customer to enter his/her name and **credit card **number (must be a number of 16 digit length). 3. The total bill amount will be updated according to the below delivery,** discount** and VAT options: Delivery: • If the customer needs delivery, then ask the customer to enter the emirate and **check if it is correct emirate **then charge **5 for Abu Dhabi**,** 10 for Al Ain **and** 20 for other emirates.** Discount: Only one discount can be applied to any total bill amount, confirm which one the customer wants to apply: ly 10% discount. 1. If the customer buys **more than 5 items**, app pply 20% discount. 2. If the total amount is **more than 200 AED** a 3. If the customer uses Fazza, apply 15% discount VAT: Apply a VAT of 5% to the total bill amount. 1. The (Payment) data structure must include the customer name, number**** total** bill amount. ** credit card 2. A new data structure (Invoice) must be created to include the (Payment) and the (Order). For example: Invoice = { order: [ ], payment: [ ] } (Note: the selection off the data structures is up to you, this is just an example) 6. Invoice:** Print the invoice with the order details and payment details.** Requirements for Part 1: 1. Your program should use appropriate user defined functions for all the processes like: ordering, updating the grocery items quantities, payment, discounts, delivery and printing the invoice. 2. Use two-dimensional data structure. Choose appropriate data structures such as a list, tuple, set or a dictionary to store data. 3. Print the invoice for the user, along with adding a VAT of 5% to the total bill amount. Part 2: Data analysis and Visualization: You are tasked to analyze and visualize data using python code and libraries. Choose one dataset from the datasets provided in this link, which also includes additional information on the datasets, and then write and comment on the code to answer the below question. 1. Write a code to Import a dataset selected from the link above into a pandas dataframe and provide a brief description of the dataset. 2. Write a code that will select a random sample of 100 from the original data set and save it as a new dataset.** (Use this sample to answer the remaining questions)** 3. Write a code to display the first 20 and last 20 rows of the dataset and display the number of columns and rows in the dataset. From what you can observe, report any insights revealed about the dataset. 4. Using the random sample dataframe from question 2, write a code that will select a column of interest from your dataset with string data type and arrange the data in alphabetical order, take note of the first value of the current sorting. Then rearrange the data in reverse alphabetical order and take note of the first value of the new sorting. 1. Using the same column generated by question 4, write a code that will summarize its content with a frequency table and create percentages. Observe the data and explain your findings. 5. Write a code to choose a specific numerical column and calculate the average of that column. Then write a code to find the maximum and minimum for that column. Observe the data and explain your findings. 6. Write a code that would create 2 new columns from a selected numerical column: The first new column is the result of multiplying by 3. The second new column should be** half the value of the original column**. 7. Using a column in your dataset with repeated values. Apply a dataframe function by writing a code to calculate the distribution of this column and create a bar chart to visualize the data. Customize the colors in the bar chart, ensure that x and y labels have appropriate titles, and a main title. Describe what you can observe from the created chart briefly. 8. Identify 2 numerical columns. Write a code that will create a line chart to visualize the data, customize the colors of each line, make sure to show x and y labels, provide a title and describe the shape of the chart. 9. Develop a specific question related to data filtering and analysis in your selected dataset. Write a code to answer your question and include a brief explanation of the results obtained. You may use **matplotlib library **for data visualisation, provided that you explain the functions used for this module, if it is not explained then it will negatively impact your grade. Instructions for Students: 1. You will be working on this assignment in a group. 2. Algorithm and Flowchart are required only for part 1. 3. You can not use AI tools (such as ChatGPT or Bard) to help answer the questions. You must only utilize the tools and programming structures that have been instructed in class thus far to receive complete credit. Code with advanced tools or programming structures not covered in the course will get a score of 0. In addition, you must understand every single line of code submitted. You must attend a technical interview on your assignment explaining your approach to coding if needed. 4. Make sure that you submit your original work. Suspected plagiarism cases will be treated as possible academic misconduct and will be reported to the College Academic Integrity Committee for formal investigation. As part of this procedure, your instructor may require you to meet with them for an oral exam on the assignment. 5. Failure to comply with the instructions will result in a 0 grade on the relevant portions of the assignment. Your instructor will grade your submission based on what you submitted on Forum within the allowed deadlines. Do not submit your assignment via email. Failure to submit an assignment or submitting an assignment for another student from the same class or another class will result in a 0 grade without the opportunity to resubmit. Submission: Primary Resource: A single PDF file of your ipynb workbook which includes separate cells for part 1 (online grocery) and part 2 (Data analysis and Visualization). A neat, clearly presented, and easy-to-read file should be submitted. The file should be submitted with the filename "student_name.pdf". The PDF file of your ipynb workbook should include the following as part of the solution to the problem given below. 1.** Algorithm**, which clearly describes all steps and sub-steps required to arrive at the solution, with clearly defined step numbers. 2.** Flowchart**, which is a picture that uses the standard notations of a flowchart and depicts the flow of control. 3.** Python code for part 1 and part 2**, which must NOT be a picture. The error-free code with all the proper documentation and indentations must be included. 4. **Test cases ** for part 1: include and explain at least 3 test cases to demonstrate that the program works correctly. One test case has to be a failure case. 5. A paragraph mentioning the individual contribution of each group member. 6.** References** (list any references used in APA format) Secondary Resource: A Zip folder. The folder should be submitted with the name "student_name.zip". The ZIP folder should include all additional files below to support your solution to the problem. 1. The .ipynb** file** 2. 2.** Flowchart (if not included in the workbook)** Note: If the PDF is not submitted as a primary resource, i.e., if the PDF as is submitted as a secondary resource, the final grade will be no more than 2. If the ipynb file is not submitted (as secondary resource), the final grade will be no more than 2. Assignment Guidelines: As you solve each part of the problem, follow the steps of algorithmic thinking as outlined below. Step 1:** Algorithm Description**. Use an algorithm and a flow chart to develop and express your algorithm that accomplishes the given task. Remember, you must be very explicit and clear to ensure one can achieve the required solution following the steps of your algorithm. Describe the input(s), output(s), and the process of the algorithm. Follow the flowchart shape conventions reading, available here. Step 2:** Python Code.** You can use Anaconda or Colab to work on the Jupyter Notebook you will submit as your final project on Forum. 1 – You may download this Jupyter Notebook to your local machine. 2 - Open a tab in your browser and type https://colab.research.google.com/. 3 - This will open a small window. Choose the last option, Show notebooks in Drive on the upper menu, "Upload". Then, choose the Jupyter Notebook you have saved. 4 - You can start working on your assignment by answering the questions in the corresponding cells. 5 - If you have any questions, please get in touch with your instructors or the CIS tutors. Implementation: Implement the algorithm in Python using the basic concepts and structures we covered in class (IMPORTANT: ONLY USE CONCEPTS COVERED IN CLASS). • User input • Variables • · Logical, Relational and Arithmetic Operators