Now You Code 5: Smore O' Matic

A smore https://en.wikipedia.org/wiki/S%27more is a popular campfire treat consisting of marshmellows, chocolate bars, and graham crackers.

  • Each smore requires 1 marshmallow. There are 60 marshmallows in a bag.
  • Each smore requires 1 graham cracker square. There are 32 squares in a box of graham crackers.
  • Each smore requires 1 section of chocolate. There are 24 sections of chocolate in package.

So with 1 bag of marshmallows, 1 box of graham crackers, and 1 package of chocolate you can only make 24 smores (and you'll have 8 leftover crackers and 36 marshmallows).

Write a program which inputs the costs of the 1 bag of marshmallows, 1 box of graham crackers, an 1 package of chocolate, then calculates total cost and cost per smore.

Example:

Cost-per-smore calculator:

Input the cost of your 1 bag of marshmallows: 2.79
Input the cost of your 1 box of graham crackers: 2.99
Input the cost of your 1 package of chocolate: 3.49

Total cost of items: 9.27
Cost per smore: 0.39

Step 1: Problem Analysis

Inputs:

Outputs:

Algorithm (Steps in Program):


In [1]:
# Step 2: write code here

Step 3: Questions

  1. Which product is wasted the most when making smores?

Answer:

  1. Does the output make sense when you enter a negative prices ? Why type of error is this?

Answer:

  1. What is one way this program could be re-written to get the cost per smore lower?

Answer:

Step 4: Reflection

Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?

To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.

Keep your response to between 100 and 250 words.

--== Double-Click and Write Your Reflection Below Here ==--


In [ ]:
# RUN THIS CODE CELL TO TURN IN YOUR WORK!
from ist256.submission import Submission
Submission().submit()