Most Improved

Programming Code

At the moment, I am taking a programming class. This class is taught by a man by the name of Lloyd Sommerer. Mr. Sommerer had taught this class for many years now, teaching many kids in his expertise. For those of you who don’t know what a Programming class is, it is a class where you learn what code is, how to write code, and how to read other’s code. I believe that this class is very important because there will be over one million jobs opportunities available in future years in this field, and this programming class will prepare me for a job like that.

The program I will be sharing with you is one of the many we were able to write during this semester-long class. This program is titled Coffee Shop and does a number of different things. First of all, this program asks you if you would like coffee or tea. Then how much along with giving you 3 different methods of shipping to choose from. It will then ask you what state you are shipping to, and will give you a receipt along with the averages and totals for that day. This last part, about giving receipts, averages, and totals is what I’m most proud of mainly because it was the most complicated to do correctly.

I faced many challenges during this program, most of them because I am still pretty inexperienced, and because my brain doesn’t think in a programming style. The averages and totals for the day were the trickiest of all because I could not for the life of me figure out how to combine and accumulate numbers without throwing away the starting number. After asking Mr. Sommerer, and going over it in class, I finally had a grasp on how the accumulation process worked, which made it so much easier o finish the program. Although, if I had more time, I think I would’ve added a little more effort in to hat along with some more debugging, because that never hurts anything.

This is one little snippet of my code:

    doAgain = 'no'
    while doAgain == 'no':
        orderCost = orderCost + itemCost 
        howMany = get_number(itemDesc)
        numberOfItems = numberOfItems + howMany
        doAgain = get_boolean()
    shippingCost, shippingMethod = get_shipping(itemCost, numberOfItems)
    subtotal = get_subtotal(shippingCost, itemCost, numberOfItems)
    tax = get_tax(orderCost, numberOfItems)
    total = get_total(subtotal, tax)
    print_receipt(itemDesc, itemCost, orderCost, numberOfItems, shippingCost, shippingMethod, tax, subtotal, total) 
    # For one person only
    return orderCost, shippingCost, tax

I picked this part of my code because it shows a number of different techniques, including: using accumulators, while loops, and many, many return statements.

I have chosen this picture because it shows my program at work, with multiple parts in motion. It shows the following: three different types of coffee and tea, a question about how much for the user, if that is all of their order, and the different shipping methods.

Finally, this last picture shows the order summary, the day’s total and averages for orders and their costs.