Repeat Programming Project 11 in Chapter 2, but if the displacement is positive then output that The

Question:

Repeat Programming Project 11 in Chapter 2, but if the displacement is positive then output that “The (material name) will expand by” the displacement in meters. If the displacement is negative then output that “The (material name) will contract by” the displacement in meters. You shouldn’t output the displacement as a negative number.


Programming Project 11

It is important to consider the effect of thermal expansion when building a structure that must withstand changes in temperature. For example, a metal beam will expand in hot temperatures. The additional stress could cause the structure to fail. Similarly, a material will contract in cold temperatures. The linear change in length of a material if it is allowed to freely expand is described by the following equation:

LΔ = aL0TΔ

Here, L is the initial length of the material in meters, L is the displacement in meters, T is the change in temperature in Celsius, and a is a coefficient for linear expansion.

Write a program that inputs a, LΔ, TΔ, and the name of the material, then calculates and outputs the material’s name and the amount of linear displacement. Here are some values for a for different materials.

Aluminum

2.31 × 10-5

Copper

1.70 × 10-5

Glass

8.50 × 10-6

Steel

1.20 × 10-5

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: