### Assignment D

Primary focus on chapter 3 Expressions and Interactivity

For each problem:

• Use the lab instructions given on the Internet at http://voyager.deanza.edu/~oldham
• Use the same format for the opening comments as in assignment A, with your name, course and quarter, assignment, problem, and short problem description.
• Create a program to meet the requirements of the problem.
• Correct any errors.
• Run the program with the specified data and save the execution results in an Execution Results comment at the end of your program.
• Print the program from Code::Blocks.
• Staple all the problems for this assignment together.

### Problem D1

You will need to include the iomanip library, as well as the iostream library, for this problem.

In classical physics:
momentum is mass times velocity ( m * v )
kinetic energy is one half the mass times the square of the velocity ( m * v2 / 2 )

Prompts the user for the mass and the velocity as input.
Use double variables.
Then compute the momentum and kinetic energy.
Print the momentum and the kinetic energy with identifying text.
The execution result should have six lines 1) input mass, 2) input velocity, 3) output mass, 4) output velocity, 5) momentum, 6) kinetic energy.
Round the printed values to two decimal positions and align the decimal points.

Test data, run the program twice:
First test input 5.0 kilograms and 4.0 meters per second
Second test input 3.15 kilograms and 10.0 meters per second
Note: With the input in kilograms and meters per second, the units for the momentum is Kg m/s and for Kinetic energy is Joules.

### Problem D2

You will need to include the iomanip library, as well as the iostream library, for this problem.

Use three named constants for the following:
small beads with a price of 9.20 dollars per box
medium beads with a price of 8.52 dollars per box
large beads with a price of 7.98 dollars per box

Ask the user how many boxes of small beads, how many boxes of medium beads, and how many large beads they need.

Print the order in the following format:

```SIZE          BOXES         COST PER BOX  TOTALS
Small             n                 x.xx   xx.xx
Medium            n                 x.xx   xx.xx
Large             n                 x.xx   xx.xx
TOTAL                                     xxx.xx
```

Replace the n x.xx xx.xx and xxx.xx with the data printed from the constants and variables in your program.
Align everything exactly as shown in the example by specifying the field width, precision, and left or right.

Test the program user input of 9 boxes of small beads, 8 boxes of medium beads, and 7 boxes of large beads.
Be sure everything aligns exactly like the format specified.