Question: In C++ Make a program that will find the cost of foods that soldiers in world war 2 commonly ate on a regular daily basis.

In C++

Make a program that will find the cost of foods that soldiers in world war 2 commonly ate on a regular daily basis. One soldier will have an order of a specific amount of different things that they ate, and you will have a fixed cost for each of the 10 items. For context; one soldier can order however many things from the list.

Items and their fixed cost:

Meat: $2.30

Eggs: $3.00

Biscuits: $2.50

Compressed Cereal: $5.00

Fruit Bar: $6.70

Instant Coffee: $2.00

Spread Cheese: $4.00

Drink Mix: $0.75

Candy Bar: $1.75

Chewing Gum: $1.25

Context: One Soldier can order however many things they want, they might not order somethings, they might order a couple of 1 item, they might order a couple of the ten different things listed so you need to be able to have a program that will output the cost of not only the order and the amount of what is being multiplied by that item and the cost, but the final cost as well. I will give you an example order.

Output: Everything below shown on screen

What is the soldier's order? (asks for input)

(Input:)

Meat: 2 portions of meat

Eggs: 2 eggs

Biscuits: 4 biscuits

Compressed Cereal: 1 compressed cereal

Fruit Bar: 14 fruit bars

Instant Coffee: 1 instant coffee

Spread Cheese: 0 spread cheese

Drink Mix: 0 drink mix

Candy Bar: 3 candy bars.

Chewing Gum: 1 pack of chewing gum.

Proof of Calculation:

Meat: $2.30 x 2 = $4.60

Eggs: $3.00 x 2 = $6.00

Biscuits: $2.50 x 4 = $10.00

Compressed Cereal: $5.00 x 4 = $20.00

Fruit Bar: $6.70 x 14 = $93.80

Instant Coffee: $2.00 x 1 = $2.00

Spread Cheese: 0 (did not order any of this item)

Drink Mix: 0 (did not order any of this item)

Candy Bar: $1.75 x 3 = $5.25

Chewing Gum: $1.25 x 1 = $1.25

Final Cost = $142.90

Thank you I will leave a comment and give 5 star rating :) much appreciated.

You can be advanced, PLS WRITE CLEAN CODE (use arrays, vectors, or files if they apply here)

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!