Electrical wire is a cylindrical conductor covered by an insulating material. Th
ID: 3701944 • Letter: E
Question
Electrical wire is a cylindrical conductor covered by an insulating material. The resistance of a piece of wire is given by the formula
where r is the resistivity of the conductor, and
L, A, and d are the length, cross-sectional area, and diameter of the wire. The wire diameter, d, is commonly specified by the American wire gauge (AWG), which is an integer, n. The diameter of an AWG n wire is given by the formula
The resistivity of five metals (at 20º C) is shown in the following table.
Write a C++ program: that accepts the metal type, wire gauge, and wire length and returns the corresponding resistance of that wire. (Use an enumeration class to store the metal type.) Identify and build at least three Incremental Build increments (you may use more) you used as you developed the program. Indicate how you tested each increment.
Increment 1:
Increment 2:
Increment 3:
Test Cases to be submitted:
Metal Resistivity, r , in W-m (ohm-meter) Silver 1.59x10–8 Copper 1.68x10–8 Gold 2.44x10–8 Aluminum 2.82x10–8 Iron 1.00x10–7 ?Explanation / Answer
#include<iostream.h>
#include<conio.h>
//#include<string.h>
#include<math.h>
#include<stdlib.h>
#ifndef _AUTOBUILD_H_
#define _AUTOBUILD_H
#define INCREMENT_BUILD_NUM TRUE
#define BUILD_NUM 3
#endif
enum metals {Silver=8, Copper=9, Gold=16, Almunium=20, Iron=7};
void main()
{
clrscr();
metals m; // metal name;
float n, l, d, a; // n is guage, l is length, d is diameter and a is area
float R;
float i,j;
char ans;
int m_name;
do
{
cout<<" Menu";
cout<<" 1. Silver";
cout<<" 2. Copper";
cout<<" 3. Gold";
cout<<" 4. Alumunium";
cout<<" 5.Iron";
cout<<" Enter Metal Name (1 -5)";
cin>>m_name;
if(m_name==1)
m=Silver;
// i=4*7.9*l;
else if(m_name==2)
m=Copper;
// i=4*8.8*l;
else if(m_name==3)
m=Gold;
// i=4*16.4*l;
else if(m_name==4)
m=Almunium;
// i=4*20.2*l;
else if(m_name==5)
m=Iron;
//i=4*7*l;
else
{
cout<<" Invalid option";
getch();
break;
}
cout<<" Enter wire guage";
cin>>n;
cout<<" Enter wire length";
cin>>l;
i=4*m*l;
d=(36-n)/39;
d=pow(92,d);
d=0.127*d;
j= 3.14 *d*d;
R=i/j;
cout<<" R is " <<R;
cout<<" Wish to Continues (Y for yes)";
cin>>ans;
}while(ans=='Y' || ans=='y');
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.