Before attending this lab, you should have read and be familiar with Chapter 2 s
ID: 3783476 • Letter: B
Question
Before attending this lab, you should have read and be familiar with Chapter 2 sections 2.1, 2.2, and 2.3 of Delores Etter's Engineering Problem Solving with C. Answer the questions below in a typed document, numbered appropriately. Print out this sheet as a cover page. Bring the completed assignment to your next lab class. The "identifier" is the name of a variable. Invent a valid variable identifier for each of the following pieces of data, and write a declaration statement, assuming all variables are double floating point values: A temperature reading in units of degrees Fahrenheit A distance measurement in units of miles Length, height, and width measurements in units of meters (3 identifiers) A temperature reading in units of degrees Rankine A measure of force in units of pounds A measure of force in unites of newtons A measure of density in units of kg/m^3 A measure of mass in units of kg A measure of volume in units of m^3 Write C assignment statements for the following mathematical equations, using the previous identifiers: Volume=length*height*width Distance=length/1609.3 Temperature(in degrees Rankine)=459.67 +Temperature (in degrees Fahrenheit) Force (in pounds)=(l/4.4482216)*Force (in newtons)Explanation / Answer
Program:
#include<stdio.h>
#include<math.h>
int main(){
//Valid Identifier Declarations
double temp_fahrenheit;
double distance;
double length;
double height;
double width;
double temp_rankine;
double force_pound;
double force_newton;
double density;
double mass;
double volume;
//Initialize variables
length = 12.08;
height = 2.03;
width = 4.3;
temp_fahrenheit = 32.23;
mass = 4.3;
//assignment statements
force_newton = mass*9.8; //taking g (gravity) = 9.8 metre per second^2: 1N = 1 kg m/s^2
volume = length*height*width;
distance = length/1609.3;
temp_rankine = 459.67 + temp_fahrenheit;
force_pound = 1/4.4482216 * force_newton;
density = mass/volume;
/* Print statements*/
printf("Length: %5.3f ",length);
printf("Height: %5.3f ",height);
printf("Width: %5.3f ",width);
printf("Volume in metre^3: %5.3f ",volume);
printf("Distance in miles: %5.3f ",distance);
printf("Temperature in fahrenheit: %5.3f ",temp_fahrenheit);
printf("Temperature in rankine: %5.3f ",temp_rankine);
printf("Mass in kilogram: %5.3f ",mass);
printf("Density in kg/m^3: %5.3f ",density);
printf("Force in newtons: %5.3f ",force_newton);
printf("Force in pound: %5.3f ",force_pound);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.