Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For option D, the instructions that explain the problem are the following: Conte

ID: 3905276 • Letter: F

Question

For option D, the instructions that explain the problem are the following:

Context


Most metals expand with heat and contract with cold. This feature


has serious implications when the dimensions of a piece of laboratory equipment are


Critics for an experiment. A typical aluminum bar that has w centimeters wide at 70 Fahrenheit degrees will be x centimeters wide at another temperature t. The value of x is calculated with the following formula:


x = w + (t - 70) * 10-4


Write a program that asks the user for the standard width of a bar at 70 degrees Fahrenheit and a tolerance for the variation in the width of the bar. Also request the initial and final temperature in degrees farenheit, and display a table containing the widths of the bar at temperatures that are in that range (between the initial temperature and the final entry), with temperature ranges of 1 degree. Place an asterisk (*) next to those bar widths that are within tolerance limits.


Remember to validate the input data with cycles.

When option D is selected, the screen should look as shown in the box below (the part of the data entry and the report that is generated is included).


Optional: To print the bar widths with 5 decimals and the decimal points of that column exit aligned investigate the use of setw, fixed and setprecision.


EXAMPLE OF SCREEN OUTPUT for option D (including data entry)





46% 1:40 PM ENGI 2310_Proyecto 39) Read-only Read Only - You can't save changes to this f. 13 80000 DFERENTES

Explanation / Answer

#include<iostream>
#include<math.h>
#include<iomanip>

using namespace std;

int main(){

   int len;
   cout << "Enter the length at 70 degree Farenheit:";
   cin >> len;

   int it,ft;
   cout << "Enter the initial temperature:";
   cin >> it;
   cout << "Enter the final temperature:";
   cin >> ft;

   cout << setw(15) << left << "Temperature" << setw(20) << "Length" << endl;
   for (int i = it; i<=ft; i++){
       int l = len + (i-70)*pow(10,-4);
       cout << setw(15) << left << i << setw(20) << l << endl;
   }
   return 0;
}