Assignment 5 Due Thursday, April 26 at 9:20am on Canvas
Assignment 5.1: Buying Pastries (10 pts)
- Open a new C++ file called pastries.cpp
- Add a block comment at the start of your program to include your name and section information:
/*
* Jennifer Parrish
* M/W 9:30-11:20am
*/
- Imagine you just opened up a bakery called "C++ Pastries."
- You want to create an online order form for customers to purchase your baked goods.
- Write a program to collect a customer's order and then print the summary of their order to the screen.
- Write four variables - 1 for each type of pastry
- eclairs
- bear claws
- croissants
- cupcakes
- Name each of your variables according to correct naming conventions.
- Write a cout statement welcoming the user to your store "C++ Pastries."
- Write four cout statements asking them how much of each type of pastry they would like to buy.
- Each cout statement needs to be followed by a cin statement to collect the information for the requested order. (four cin statements)
- Finally, write a cout statement to print a summary of the customer's order to the screen.
- Save your file as pastries.cpp and upload it to Canvas.
- Your output should look identical the following (except the user input will vary).
- Notice the blank lines. These are important, so don't forget to include them!
Welcome to C++ Pastries! Allow me to assist you with your order.
Please enter the number of eclairs: 3 Please enter the number of bear claws: 5 Please enter the number of croissants: 9 Please enter the number of cupcakes: 0
You ordered the following: 3 eclairs 5 bear claws 9 croissants 0 cupcakes
Assignment 5.2: Mowing Quotes (10 pts)
Your friend is starting a gardening business to mow lawns as a way to
help pay for living expenses while going to school. He needs a good way
of estimating how much to charge for his services. Here is how he has
decided to charge for his work:
- He's going to charge $12.75 for travel time, no matter how much time it takes him to get to the house.
- He's going to charge $25.00 per hour he spends cutting the lawn; and
his estimates will be based on cutting 2500 square feet (SF) of lawn
per hour.
- He has decided he will round up the estimated number of hours for a
job. For example, if someone has a 30 feet by 90 feet lawn (2700 SF),
he'll estimate that it's a 2 hour job; but a 2500 SF lawn would only be a
1 hour job.
- Because he's starting out, he's going to give a 10% discount to all
his clients. This discount will apply to both travel time, and to the
cost of cutting the lawn.
- Finally, he needs to charge tax, which is currently 15.3%.
- Tax is applied after the 10% discount is given to the sum of travel cost and mowing cost.
image source
Project Specifications
Enter the size of the lawn's width in feet : 47.5 Enter the size of the lawn's length in feet : 67
To cut a lawn 47.5 by 67 will take 2 hours.
Estimate:
=========
Cutting (2H) $50
Travel Cost $12.75
--------
Subtotal $62.75
Discount (10%) - $6.275
Tax (15.3%) + $8.64067
========
Total Owing: $65.1157
- In the above example run, the user entered the values shown in italics
(for emphasis) to produce the output.
- Your program does NOT print the
characters in italics, nor does the user input appear in italics.
Remember to include the $ (dollar sign) characters.
- The output must line up nicely as shown in the Example Run.
- After displaying the output, exit the program, and upload it to Canvas.
Hints:
- Calculating a tax of 15.3% is the same as multiplying by 0.153
- To round up use the
ceil() math function from Lesson 5
|
|