Answer to Question #50866 in C++ for chad

Question #50866
The fact that most metals expand when heated and contract when cooled has serious implications when the dimensions of a piece of laboratory equipment are critical to an experiment. A typical aluminum bar that is w cm wide at 70 degrees Fahrenheit will be

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

cm wide at a nearby temperature t. Write a program that prompts the user for the standard width of a bar at 70 degrees Fahrenheit and for a tolerance for width variation. Then display a table like the one below indicating the bar’s width at temperatures from 60 degrees to 85 degrees in one degree intervals and marking with a star (*) the temperatures at which the bar’s width is within the tolerance.



Sample Output:

Ideal Bar Width (at 70 degrees F): 10.00000 cm

Tolerance for Width Variation: 0.00050



Temperature Width Within Tolerance

(degrees F) (cm)



60 9.99900

61 9.99910

62 9.99920

63 9.99930

64 9.99940

65 9.99950 *

66 9.99960 *

…………



85 10.0015
1
Expert's answer
2015-02-27T05:09:37-0500
MATLAB CODE% The fact that most metals expand when heated and contract when cooled has serious implications
% when the dimensions of a piece of laboratory equipment are critical to an experiment.
% A typical aluminum bar that is w cm wide at 70 degrees Fahrenheit will be
%
% x= w + (t – 70) x 10-4
% cm wide at a nearby temperature t.
% Write a program that prompts the user for the standard width of a bar at 70 degrees
% Fahrenheit and for a tolerance for width variation. Then display a table like the one below indicating
% the bar’s width at temperatures from 60 degrees to 85 degrees in one degree intervals and marking with a star (*)
% the temperatures at which the bar’s width is within the tolerance.
%
clc,close all,clear all
t=60:85;
w=9.99900:0.00010:10.0015;
x=w+(t-70)*1e-4;
[t' w' x']

RESULTS
60.0000 9.9990 9.9980
61.0000 9.9991 9.9982
62.0000 9.9992 9.9984
63.0000 9.9993 9.9986
64.0000 9.9994 9.9988
65.0000 9.9995 9.9990
66.0000 9.9996 9.9992
67.0000 9.9997 9.9994
68.0000 9.9998 9.9996
69.0000 9.9999 9.9998
70.0000 10.0000 10.0000
71.0000 10.0001 10.0002
72.0000 10.0002 10.0004
73.0000 10.0003 10.0006
74.0000 10.0004 10.0008
75.0000 10.0005 10.0010
76.0000 10.0006 10.0012
77.0000 10.0007 10.0014
78.0000 10.0008 10.0016
79.0000 10.0009 10.0018
80.0000 10.0010 10.0020
81.0000 10.0011 10.0022
82.0000 10.0012 10.0024
83.0000 10.0013 10.0026
84.0000 10.0014 10.0028
85.0000 10.0015 10.0030

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS