Lecture 3: Parentheses
This assignment is due on Sunday, August 28 at 11:59pm. Submit it using Handin as assignment lecture3. Your submission is only accepted if the message “Handin successful” appears.
(place-image (scale 2 bicycle horizontal-position 150 (empty-scene 300 300)) |
- At the market, I bought an apple for $1 and a sandwich for $5. What is the total that I spent? The answer to this problem is (+ 1 5), so put this in your Definitions Window:
At the market, I bought an apple for $1 and a sandwich for $5. Because a sandwich is a prepared food item, it is taxed 7%. What is the total that I spent? Define a constant named part2 with your formula.
At the market, I bought a baked apple for $1 and a sandwich for $5. Because both are prepared food items, both are taxed 7%. What is the total that I spent? Define a constant named part3 with your formula.
At the restaurant, I ordered a baked apple for $1 and a sandwich for $5. Both are taxed 7%, and I also decided to pay 20% tip on the amount before tax was added. The tip is not taxed. What is the total that I spent? Define a constant named part4 with your formula.
At the restaurant, I ordered a baked apple for $1 and a sandwich for $5. Both are taxed 7%, and I also decided to pay 20% tip on the amount after tax was added. What is the total that I spent? Define a constant named part5 with your formula.
Like the last probem, but what if I rounded up the final amount to the nearest dollar (using the ceiling function)? Define a constant named part6 with your formula.