Python programming assignment
Assignment 1
Stock Management
The goal here is to write some software that would assist a retail store manage their stock levels. The assignment will get progressively more complex as it proceeds - the early stages will be reasonable straight forward and will be sufficient for a passing grade, and the more advanced stages are for those who wish to go further and target a higher overall result.
General Requirements
All assignments should be written in Python 3 and should run in IDLE. They can be written on any type of computer, but they should be able to be executed in the computer pool.
The highest marks will be for working code. However, in cases where there are problems, you will be assigned marks for how you approached the task. It is also expected that you will provide comments in the programs to explain how it works, and these comments will account for up to 10% of the overall grade.
In each case example output is given. You should try and make your output and process match the example as closely as possible.
Stage 1: Data Entry
Write a program which requests that requests a product name and a stock number. Store that data in a List or a Dictionary. After the user has entered data, request that the user enters Y or N to continue. If they enter N, print the list of products and stock numbers to the screen. If they enter Y, repeat the first step.
Your program should produce the following result:
************************* Stock Manager ************************* Product Name: Widgets Stock Level: 14 Widgets has been entered with a stock of 14 products. Do you wish to enter another record? (Y/N) Y Product Name: Fidgets Stock Level: 22 Fidgets has been entered with a stock of 22 products. Do you wish to enter another record? (Y/N) N ------------------------- Product Stock ------------------------- Widgets 14 Fidgets 22 -------------------------
Stage 2: Validation and Totals
Building on stage 1, you now need to ensure that the program checks for valid entries in each case, and converts the text to the appropriate format.
You need to:
· Ensure that a stock number and product name were entered, If any of these were not entered, do not record that item and go straight to asking if they wish to continue.
· Ensure that the user enters either "Y", "y", "N" or "n" when asked if they wish to continue. Continue to ask until they enter a valid result.
· Ensure that the stock number is a number
· Output the total number of products held in stock
Sample output:
************************* Stock Manager ************************* Product Name: Widgets Stock Level: 12 Widgets has been entered with a stock of 12 products. Do you wish to enter another record? (Y/N) Do you wish to enter another record? (Y/N) d Do you wish to enter another record? (Y/N) y Product Name: Do you wish to enter another record? (Y/N) Y Product Name: Fidgets Stock Level: Twenty Do you wish to enter another record? (Y/N) Y Product Name: Fidgets Stock Level: 20 Fidgets has been entered with a stock of 20 products. Do you wish to enter another record? (Y/N) n ------------------------- Product Stock ------------------------- Widgets 12 Fidgets 20 ------------------------- Total 32 -------------------------
Stage 3: Product List and Menu
This involves three separate jobs:
· Create a menu with multiple options
· Add products separately and allow the user to select the product.
· Allow multiple stock numbers to be entered for each product and record the total
Sample Output
************************* Stock Manager ************************* ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: A ------------------------- Product name: Widgets Widgets was added to the list of products. ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: a ------------------------- Product name: Fidgets Fidgets was added to the list of products. ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: i ------------------------- Enter a product from the following list: Widgets Fidgets Product name: Trees *** Error: Product not listed ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: i ------------------------- Enter a product from the following list: Widgets Fidgets Product name: Widgets Stock Level: 12 Widgets has has been updated to a stock of 12 products. ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: i ------------------------- Enter a product from the following list: Widgets Fidgets Product name: Widgets Stock Level: 4 Widgets has has been updated to a stock of 16 products. ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: i ------------------------- Enter a product from the following list: Widgets Fidgets Product name: Fidgets Stock Level: *** Error: Incorrect value entered ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: i ------------------------- Enter a product from the following list: Widgets Fidgets Product name: Fidgets Stock Level: 2 Fidgets has has been updated to a stock of 2 products. ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: l ------------------------- Product Stock ------------------------- Widgets 16 Fidgets 2 ------------------------- Total 18 ------------------------- ------------------------- Menu ------------------------- (A)dd a product (I)ncrease stock level (L)ist products and stock (Q)uit ------------------------- Your choice: q Goodbye
Stage 4: Importing, Exporting and Reporting
In the final stage we introduce the ability to load product lists, export stock levels, and compare stock levels with expected stock levels to generate a report. You will be provided with a sample file for stock and a sample file to compare against.
This will require additional research into Python
Now that things are getting more complex, you are expected to use functions to manage these tasks in your program.
Sample output: