Use a single Mfile for this problem and use mnemonic variabl

Use a single M-file for this problem and use mnemonic variable names of 3 characters or more for all the values given. Make sure your program is in an order that can be understood and followed easily. The following problem considers temperature conversions. Use the following equations that give relationships between temperatures in Fahrenheit (T_F). Celsius (T_C). Kelvin (T_K). and Rankin (T_R): You must use/algebraically manipulate the following equations in your program. Do not use other temperature equations such as from a google search. T_F = T_R - 459.67 T_F = 9/5 T_C + 32 T_R = 9/5 T_K Use a single input statement to provide the range of temperature data to the program to generate a table using \"fprintf\" with the conversions from Fahrenheit to Kelvin for values from 0 degree F to 200 degree F with the increment in 20 degree intervals, all values showing 3 decimal places. Use a single input statement to provide the range of temperature data to the program to generate a table using \"fprintf\" with the conversions from Celsius to Rankin for values from 0 degree C to 100 degree C with the increment in 20 degree intervals, all values showing 3 decimal places. Use a single input statement to provide the range of temperature data to the program to generate a table using \"fprintf\" with the conversion from Celsius to Fahrenheit for values from 0 degree C to 100 degree C with the increment in 20 degree intervals, all values showing 3 decimal places. Each Column of the table should have a heading that shows the type of measure and the units of measure. Exercise the option to put the units as a separate line if needed. The table of data should be properly spaced allowing all the decimal points and decimal values to line up. Use a single input statement that asks for your full name, then print your full name using disp after printing the table.

Solution

% matlab code display conversion tables

name = input(\"Enter your name: \",\'s\');
fahrenheit = 0.0;
fprintf(\"FAHRENHEIT\\tKELVIN\ \");
while fahrenheit <= 200
rankin = fahrenheit + 459.67;
kelvin = (rankin*5)/9;
fprintf(\"%0.3f\\t\\t%0.3f\ \",fahrenheit,kelvin);
fahrenheit = fahrenheit+20;
end
disp(name);

disp(\"----------------------------\ \");

name = input(\"Enter your name: \",\'s\');
celsius = 0.0;
fprintf(\"CELSIUS\\t\\tRANKIN\ \");
while celsius <= 100
fahrenheit = ((celsius*9)/5) + 32;
rankin = fahrenheit + 459.67;
fprintf(\"%0.3f\\t\\t%0.3f\ \",celsius,rankin);
celsius = celsius+20;
end
disp(name);


disp(\"----------------------------\ \");

name = input(\"Enter your name: \",\'s\');
celsius = 0.0;
fprintf(\"CELSIUS\\t\\tFAHRENHEIT\ \");
while celsius <= 100
fahrenheit = ((celsius*9)/5) + 32;
fprintf(\"%0.3f\\t\\t%0.3f\ \",celsius,fahrenheit);
celsius = celsius+20;
end
disp(name);

%{
output:

Enter your name: ayush verma   
FAHRENHEIT KELVIN   
0.000 255.372
20.000 266.483
40.000 277.594
60.000 288.706
80.000 299.817
100.000 310.928
120.000 322.039
140.000 333.150
160.000 344.261
180.000 355.372
200.000 366.483
ayush verma
----------------------------

Enter your name: jason roy
CELSIUS RANKIN   
0.000 491.670
20.000 527.670
40.000 563.670
60.000 599.670
80.000 635.670
100.000 671.670
jason roy
----------------------------



Enter your name: alex hales
CELSIUS FAHRENHEIT
0.000 32.000   
20.000 68.000   
40.000 104.000
60.000 140.000
80.000 176.000
100.000 212.000
alex hales

%}

 Use a single M-file for this problem and use mnemonic variable names of 3 characters or more for all the values given. Make sure your program is in an order th
 Use a single M-file for this problem and use mnemonic variable names of 3 characters or more for all the values given. Make sure your program is in an order th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site