Question: C++ Programing Joey is on a budget, and has been bringing peanut butter and jelly sandwiches to work. He would like a program which can

C++ Programing

Joey is on a budget, and has been bringing peanut butter and jelly sandwiches to work. He would like a program which can calculate the exact cost of one peanut butter sandwich, and allow him to determine which brands of ingredients he should buy to best fit his budget. For one sandwich Joey uses 2 slices of bread, 1/20 of a jar of peanut butter and .10 (one tenth) of a jar of jelly.

Your program is to accept as input:

* the price of a jar of peanut butter (a double value)

* the brand of the peanut butter (a string value)

* the price of a jar of jelly

* the brand of the jelly

* the price of a loaf of bread (a double value)

* the number of slices of bread (an int value)

* the type of the bread

Once your program has read in and stored all of the input, you are to calculate and print:

*the cost of the peanut butter being used

* the cost of the jelly being used

* the cost of the bread being used (dont forget to use 2 slices)

* the cost of the sandwich

* Use the name of the product in the above output

For example, your program output might look like:

Please enter the price of a jar of peanut butter

3.50

Please enter the type of peanut butter

JIF

Please enter the price of a jar of jelly

4.00

Please enter the type of jelly

Welch's

Please enter the price of a loaf of break

3.00

How many slices of bread are there in a loaf

30

Please enter the type of bread

WonderBread

The cost of JIF used is $0.17

The cost of Welch's used is $0.40

The cost of the WonderBread is $0.20

The cost of the sandwich is $0.77

Press any key to continue . . .

Be sure that your program contains a comment with your name, plus short comments which indicate what is going on in the program. Also, variable names should be descriptive, and provide an idea of the howvariable is to be used.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!