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

Problem Statement Your company manufactures electrically conductive metal bars w

ID: 2084822 • Letter: P

Question

Problem Statement Your company manufactures electrically conductive metal bars with custom polygonal cross sections. The metal extrusion machine is limited to producing metal bars with a four-sided polygon as the cross-section. You are given the assignment to calculate the electrical resistance of the bar given its cross-section shape, length, and type of metal. Background Pi Arbitrary Cross-section The DC resistance of a conductor having a length L and a uniform cross-sectional area A is given by this equation: where is the electrical conductivity of the conductor. Table I shows the conductivity of common metals used in electrical wires. Table 1: Metal electrical conductivity Conductor Silver Copper Gold Aluminum Platinum Conductivity (S/m) 6.30x10 5.96x 0' 4.10x10 3.50x107 0.943x10

Explanation / Answer

#include <iostream>
#include <cmath>
using namespace std;
double area1(double*, double*);
double area2(double*, double*, double*, double*);
int main()
{
while(1){
double const s = 6.30e+7;
double const c = 5.96e+7;
double const g = 4.10e+7;
double const a = 3.50e+7;
double const p = 0.943e+7;
double length;
int q;
double x3,y3,x4,y4,R;
cout << "********************************************************"<< endl;
cout <<"*********************************************************"<<endl;
cout<< "Enter indeces of ponit P3 " << endl;
cin >> x3 >> y3;
cout << endl;
cout<< "Enter indeces of ponit P4 " << endl;
cin >> x4 >> y4;
cout << endl;
double A1, A2, total_area;
if ((x3==x4)&& (y3 == y4))
{
cout << "indeces are not valid " << endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}

else if ((x3>25)||(x3<0))
{
cout << "indeces are not valid " <<endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}


else if ((x4>25)||(x4<0))
{
cout << "indeces are not valid " <<endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}

else if (x4>=x3)
{
cout << "indeces are not valid " <<endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}

else if ((y3<=4.0)||(y4<=4.0))
{
cout << "indeces are not valid " <<endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}

else{
A1 = area1(&x3, &y3);
A2 = area2(&x3,&y3, &x4, &y4);
total_area = A1+A2;
cout << "Total area in mm^2 = " << total_area << endl <<endl;
cout << "scientific value is " << std::scientific;
cout << total_area << endl <<endl ;
}

cout << "Enter length of bar in meter ";
cin >> length; cout <<endl;
if (length <=0)
{
cout << "Length is not valid " <<endl<< endl << endl;
cout << "press 0 to quit or press 1 to continue for further calculation " ;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;
}
else{
char input;
cout << "Enter required melat " ;
cin >> input;
switch (input){

case 's' : {

R = (length*1000000)/(s*total_area);
break;
}
case 'c' : {

R = (length*1000000)/(c*total_area);
break;
}
case 'g' : {

R = (length*1000000)/(g*total_area);
break;
}
case 'a' : {

R = (length*1000000)/(a*total_area);
break;
}
case 'p' : {

R = (length*1000000)/(p*total_area);
break;
}
default : {
cout << "Error: metal name did not match" << endl;
}

}

cout << "Resistance in ohm = " << R << endl;

}
cout << "press 0 to quit or press 1 to continue for further calculation " << endl << endl;
cin >> q;

if (q == 0)
break;
if (q==1)
continue;

}
return 0;
}

double area1(double *a, double *b){
double x1 = 6.0;
double y1 = 4.0;
double x2 = 17.0;
double y2 = 4.0;
double x,y,z;
double s,A;
x = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
y = sqrt((x1-(*a))*(x1-(*a))+(y1-(*b))*(y1-(*b)));
z = sqrt((x2-(*a))*(x2-(*a))+(y2-(*b))*(y2-(*b)));
s = (x+y+z)/2;
A = sqrt(s*(s-x)*(s-y)*(s-z));
return A;
}


double area2(double *a, double *b, double *a1, double*b1){
double x1 = 6.0;
double y1 = 4.0;
double x,y,z;
double s,A;
x = sqrt((x1-(*a1))*(x1-(*a1))+(y1-(*b1))*(y1-(*b1)));
y = sqrt((x1-(*a))*(x1-(*a))+(y1-(*b))*(y1-(*b)));
z = sqrt(((*a1)-(*a))*((*a1)-(*a))+((*b1)-(*b))*((*b1)-(*b)));
s = (x+y+z)/2;
A = sqrt(s*(s-x)*(s-y)*(s-z));
return A;
}

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