The HomewareCity Shopping Cart System

The HomewareCity Shopping Cart System

The HomewareCity Shopping Cart System

Programming Assignment Help

At Programming Homework Tutors, we believe in providing our students with practical, real-world examples of how to apply the concepts they learn in class. That’s why we’ve developed a variety of sample projects to help you see how our courses can be used to create impactful solutions in your field of study.

 

Goals and Topics

The assignment problem is straightforward. All necessary details have been supplied. The solution to the problem will use the programming concepts and strategies covered in weeks 110 delivered in the course. The subgoals are:

  • Translating simple design into Pseudocode and then Python code;
  • Obtaining an advanced understanding of values, variables and lists;
  • Understanding program input and output, functions and expressions;
  • Understanding simple strategies like iteration, validation, sum and count;
  • Understanding of advanced strategies like swapping, sorting and searching;
  • Translating simple design into Python code;
  • The mechanics of editing, interpreting, building and running a program;
  • Testing a program;
  • Commenting source code, especially Docstring on functions;
  • Becoming confident and comfortable with programming small problems.

 

Background

HomewareCity is a fast-growing family business in Toowoomba. In the past years, HomewareCity has served Toowoomba local community well. Aiming to promote customers’ shopping experience and dealing with increasing demands raised by busy, aged, or disability customers, HomewareCity is going to introduce an online shopping facility to the community and thus, needs to develop a shopping cart system (see: http://en.wikipedia.org/wiki/Shopping cart software) to allow customers to shop online. Against a group of talented programmers, you want to win the contract to develop the system. But first, you need to develop a prototype program to demonstrate the main functionality of the system, as required by HomewareCity. Note that HomewareCity has specifically required that the program is going to be developed in Python.

 

The Task

In this assignment, you are required to design, implement and test a program that can be used to manage a simple shopping cart system with shopping records, which are stored in a list. Your program must provide an interactive design that allows the user to:

  • see the Catalogue
  • create new shopping records and add them to the shopping cart system;
  • display all shopping records with details;
  • calculate the total cost of all the records or the records of searching outcome;
  • search for specific shopping records in all records;
  • sort all shopping records based on the product code.

The program is to be implemented by Python and as a .ipynb file running on a Jupyter notebook.

 

Shopping cart system 

Figure 1 illustrates the catalogue provided for customers. The data in the catalogue for your program have been added to the product_list and price_list of the “Product and price lists.txt”. Please directly copy the text and paste itthem to your .ipynb file without modification. When the unit price of a product is no less than $30, its value is high. Otherwise, it is low.

 

Figure 1: Catalogue

Figures 2 and 3 on the next page illustrate the shopping cart system with sample outcomes of show_record() and sorting. Please use this illustration as the reference for the following descriptions.

 

Shopping records

This program will hold or encapsulate data for the product code, product name, price, quantity and shipping method. With respect to each of the attributes, a shopping record can be represented like the following sample: 

“2/Tea Set/High/39.95/1/Pick-up”

This can be deciphered as: for this shopping record, the product code is “2”, the product name is Tea Set, its value is high, unit price is $39.95, quantity is 1, shipping method is “Pick-up”. You should create a global variable – list – to store all such shopping records. For the sake of easy explanation, we refer to this variable by shopping_record_list in the rest of this document.

 

Some limitations must be imposed on the shopping records::

Product code must be “END”(case sensitive) or an integer number and only if:

  • 0 <= code <=39;

Quantity must be an integer number and only if:

  • 0 < quantity <=49;

 

Your Tasks

It is strongly suggested that the following approach is to be taken to design and implement the program.

 

Show the catalogue

You should use print functions, string handling techniques and iterations to print all the 40 products’ information.  The indentation of the records should be the same as Figure 1. The maximum length of the product string is 35. Using built-in functions or some libraries to print a table is not acceptable for this assignment.

 

Interactive design

You should implement and test the Interactive design of the shopping cart system for users to input value and obtain outputs. Input functions should be applied for users to enter shipping method, product code and quantity. 

 

The add_record() Function

You should design, implement and test a function to add a shopping record to the shopping cart system. A shopping record will be added to the shopping cart system each time when all the inputs (product code, quantity and shipping method) are valid. The program will continually  ask the user to input the record by three input functions until “END” (case sensitive) is input for the product code. The function handles the following tasks:

The “product code” is obtained by the first input function. Validate if the input for “product code” is correct by using the function is_valid_code() described below;

If the valid “product code” is not “END”. Collect corresponding product name and price from the product_list and price_list according to “product code” for the shopping record;

If the entered “product code” is “END”. Stop the iteration and collect all the entered records and then run the show_records() Function.

The “quantity” is obtained by the second input function. Validate if the input for “quantity” is correct by using the function is_valid_quantity() described below; The “shipping method” is obtained by the third input function. Validate inputs are “Pick-up” and “Delivery”, case insensitive.

Add the shopping record into the shopping_record_list list if all data are valid, otherwise, return an error message for each input function;

 

The is_valid_code() Function

You should design, implement and test a function to validate the data input for the product code attribute of a shopping record. The function should alert an error message and return false if the input is invalid, otherwise, return true.

Refer to the product code section on page 2 for what the function needs to check for validation.

 

The is_valid_quantity() Function

You should design, implement and test a function to validate the data input for the quantity attribute of a shopping record. The function should alert an error message and return false if the input is invalid, otherwise; return true.

Refer to the quantity section on page 2 for what the function needs to check for validation.

 

 

 

 

The show_records() Function

You should design, implement and test a function to show all existing records in the shopping cart system. The function should access the shopping_record_list and print all existing shopping records in an acceptable format as shown in Figure 2. The length of “—-” under

“Product” should be 35. The indentation of the output should be the same as shown in Figure 2.

 

 

Figure 2: Shopping records and total cost

 

You could create some dummy shopping records manually and store them in the shopping_record_list to test this function, while other functions remain incomplete.

 

The total_cost() Function

You should design, implement and test a function to calculate the total cost of shopping records and display the value as a total cost as Figure 2. 

You should use the following as the guideline:

Calculate the total cost for all the records or the records of searching outcome and show the results after the list of records.

If the customer enters “Delivery” as the shipping method, a 10% delivery fee will be added to the corresponding products. In addition, if the value of the product is high, a $2 packing fee is applied for each unit of product. No packing fee for low value products or pick-up

The records for the same product may be added at a different time and the same products in one transaction may be transferred by different shipping methods (e.g., “Tea Set” in Figure 2).

The total cost = First product unit price * quantity*(1+10%)(if shipping method is “Delivery”) +quantity*2(if the delivery item’s value is high)+ Second product cost

+……

Take the data in figure 2 as an example: Total cost =

39.95*2*(1+10%)+2*2+19.95*3*(1+10%)+39.95*1+99.95*2+39.95*1*(1+10%)+1* 2=$443.52

control 2 digits after the decimal point for the total cost.

If no record, the total cost will be “0”.

 

The search_record() Function

After all the records are presented as Figure 2. You should design, implement and test a function to search the shopping records using keywords given by the user and display the search results of the shopping cart system. You should list the search results following the specific order according to the sort_records() Function. You should use the following as the guideline:

Let the user enter the search keyword. The program will do the search in the product names of shopping records. If the user doesn’t enter any keyword and press the “Enter” key. The program will return an error message.

The keywords for search_record() function are case insensitive. That means if the users search “Et”, the program will show all the records whose product names include “et” or “Et”.

If the product codes of two or more records are the same, the records are merged, as shown in Figure 3.

The cost for each product is presented in the last column, control 2 digits after the decimal point). The cost includes the shipping fee and packing fee. For example, the cost for “Tea Set” in Figure 3:

                        39.95*2*(1.1)+2*2+39.95*1+39.95*1*(1.1)+1*2=177.79

  • Display the search results in the list as Figure 3.

Figure 3: Search results by keyword “Et”

The sort_records() Function

You should design, implement and test a function to sort search results based on the product code. The sorting orders are specified as follows:

  • Product code: from 0 to 39.

You should use string handling techniques to extract the corresponding product code from the shopping records and sort the shopping records based on these values.

 

Program Integration Test

You need to test the program for all functionality thoroughly before delivering the program to clients. The program should be running appropriately without any syntax or logic errors.

 

Disclaimer

The sample projects provided on our website are intended to be used as a guide and reference for educational purposes only. While we have made every effort to ensure that the projects are accurate and up-to-date, we do not guarantee their accuracy or completeness. The projects should be used at your own discretion, and we are not responsible for any loss or damage that may result from their use.
At Programming Homework Tutors, we are dedicated to helping students and educators achieve their goals by providing them with the resources they need to succeed. Our website offers a variety of tools and resources that can help you with the project mentioned above.
Whether you need help with research, project management, or technical support, our team of experts is here to assist you every step of the way. We offer online courses, tutorials, and community forums where you can connect with other learners and get the support you need to succeed.
If you’re looking to take your skills to the next level and make an impact in your field, we invite you to explore our website and see how we can help you achieve your goals.

No Comments

Post A Comment

This will close in 20 seconds