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

The preview on the */ did not format correct when I copied and pasted my work. I

ID: 3625977 • Letter: T

Question

The preview on the */ did not format correct when I copied and pasted my work. I am using word 2010.
Chapter 5 Problem #2 pg. 335

2.) Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and Length L (inches) subject to the compression loads P of 10,000 to 1,000,000 pounds in increments of 100,000 pounds. The modulus of elasticity E for steel is 30 x 106.
A function to compute the stress from the formulas:
Stress f = P/A
A = pD2 / 4.0
A function to compute the strain from the formulas:
Elongated or shortened length = ?L = fL/ E
Strain e = ?L/L = f/E
A function to output the stress and strain at different loads of P
The function should call each other as shown in the structure chart.
Flowchart: did not copy. should be Main with it branching off to compute stress, compute strain, compute output.
/*************************************************************************************************/
/* */
/* Computation of the stress and strain of a steel rod */
/*************************************************************************************************/
/* Input Variables: */
/* Diameter (D) – diameter of rod (inches) */
/* Length (L) – length of rod (inches) */
/* Compression Loads (P) - 10,000 to 1,000,000 (pounds) */
/* Computed Variables: */
/* stress – stress of the steel rod */
/* strain – strain of the steel rod */
/* Output Variables: */
/* stress – stress of the steel rod at different loads (P) */
/* strain – strain of the steel rod at different loads (P) */
/* Functions: */
/* funcstress – function to compute stress */
/* funcstrain – function to compute strain */
/* funcoutput – function to output the stress and strain at different */
/* loads of (P) */
/**************************************************************************************************/
#include
#include

float funcstress(float, float, float)
float funcstrain(float, float)
void funcoutput(float, float, float)

int main()
{
float diameter, length;
float stress, strain;
printf(“INPUT DATA ”);
scanf(“%f, %f, %f, “, &diameter, &length);
printf(“nOUTPUT DATA ”);
printf(“Diameter = D”);
printf(“Length = L”);

stress = funcstress(P/A, whereas A = PI*Dpow(double, double)/4.0);
strain = funcstrain(f/E);

printf(“stress of steel rod”);
printf(“strain of steel rod”);

return 0;
}

/***************************************************************************************************/
/* */
/* Function to compute the stress from the formula */
/* */
/*************************************************************************************************/
/* */
/* Constants: */
/* E = 30*10pow(6) */
/* PI = 3.141592654 */
/* Area = A = PI*Dpow(2) /4.0 */
/* stress = f = P/A */
/* */
/* Input Parameters: */
/* compression load = P = 10000 – 1000000 (pounds) */
/* area = A = PI*Dpow(2)/4.0 */
/* diameter = D(inches) */
/* Return Variable: */
/* stress = f = P/A */
/*************************************************************************************************/

float functstress(float P, float A, float D)
{
const float (E = 30*10pow(6), PI = 3.141592654,
Area = A = PI*Dpow(2)/4.0, stress = f = P/A)
float stress

stress = (P/A)

return stress;
}

/*************************************************************************************************/
/* */
/* Function to compute the strain from the formulas */
/* */
/*************************************************************************************************/
/* */
/* Constants: */
/* Elasticity = E = 30*10pow(6) */
/* */
/* Input parameters: */
/* strain e = f/E */
/* stress = f = P/A */
/* */
/* Return Variable: */
/* strain = e = f/E */
/*************************************************************************************************/

float funcstrain(float P/A, float Elasticity = E = 30*10pow(6))
{
float strain ;
strain = e = f/E
return strain
}

Explanation / Answer

#include <stdio.h>

#include <math.h>

const double E = 30*pow(10,6), PI = 3.141592654;

double funcstress(float, double,float);

double funcstrain(double, double);

int main()

{

float D, length;

double stress, strain;

printf("INPUT DATA ");

scanf("%f %f ",&D,&length);

printf(" OUTPUT DATA ");

printf("Diameter = D");

printf("Length = L");

float P=10000;

double A= PI*pow(D,2)/4.0;

do

{

stress = funcstress(P,A,D);

strain = funcstrain(stress,E);

funcoutput(stress,strain);

P=P*10;

}while(P<1000000);

return 0;

}

/***************************************************************************************************/

/* */

/* Function to compute the stress from the formula */

/* */

/*************************************************************************************************/

/* */

/* Constants: */

/* E = 30*10pow(6) */

/* PI = 3.141592654 */

/* Area = A = PI*Dpow(2) /4.0 */

/* stress = f = P/A */

/* */

/* Input Parameters: */

/* compression load = P = 10000 – 1000000 (pounds) */

/* area = A = PI*Dpow(2)/4.0 */

/* diameter = D(inches) */

/* Return Variable: */

/* stress = f = P/A */

/*************************************************************************************************/

double funcstress(float P, double A, float D)

{

double stress;

stress = (P/A);

return stress;

}

/*************************************************************************************************/

/* */

/* Function to compute the strain from the formulas */

/* */

/*************************************************************************************************/

/* */

/* Constants: */

/* Elasticity = E = 30*10pow(6) */

/* */

/* Input parameters: */

/* strain e = f/E */

/* stress = f = P/A */

/* */

/* Return Variable: */

/* strain = e = f/E */

/*************************************************************************************************/

double funcstrain(double f, double E)

{

double strain ;

strain=f/E;

return strain;

}

void funcoutput(double str, double strn)

{

printf("stress of steel rod%ld",str);

printf("strain of steel rod%ld",strn);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote