Skip to content

Instantly share code, notes, and snippets.

@HoughIO
Created November 21, 2014 13:06
Show Gist options
  • Save HoughIO/f126f110de375f23ae81 to your computer and use it in GitHub Desktop.
Save HoughIO/f126f110de375f23ae81 to your computer and use it in GitHub Desktop.
#Graham Hough
#Section 15
#Program 4 Design
#program4design.py
#Purpose: To open files and read UPC codes, then print a reciept.
#Preconditions: Files contiaining inventory and upc codes to read
#Postconditions: None
#Preconditons: Files to call to open
#Postconditions: Program ends
#def main():
#call the function get_data_from_file(inventory) and save it in a varible (inventory_string?)
#call the function get_data_from_file(transactions) and save it in a varible(transaction_string)
#in main compare the data from inventory_string and transaction_string
#run print_reciept(inventory_string, transaction_string)
#preconditions: The name of the file
#postconditions: To return the string of upc codes and items
#def get_data_from_file(name):
#open the file(by name)
#do data validation to make sure the program exists, has data, and is readable
#parse the file by new line
#create a list from the file
#validate the data from the list
#create a loop here to vaildate each upc code
#For i in...
#call check_UPC(i) for each line with a upc
#if the return value is true allow it
#if the return value is false, remove it from the list.
#turn the list into a string.
#return the string
#Preconditions: UPC codes to read from
#Postconditions: return true or false for a valid code
#def check_UPC(value):
#check the legnth of the upc code
#if too long or too short return false
#Take the value and save it
#run value through the algorithem for the check digit
#compare the two values
#if the values are valid upc codes then return true
#else return false
#precondtions: running the entire program before this
#postconditions: print outputs and end the program
#def print_recipt(one, two):
#Take the strings of items named one and two and compare them
#run a loop for each line of the string
#print each item, while consolidating multiple items
#print the price of the items
#print a subtotal so far
#when out of lines to read save the running total
#take into account weather the item has tax or not
#if tax then print that into account in the subtotal
#add the taxed ammount to the total
#print the total number of taxable items
#print the total number of food items (no tax)
#print the complete running total
#print the total tax
#print the total bill
#print the total items sold
#run main(), starting the program.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment