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

4ijacksoneng.ua.edu/ x egg com x The University of Ala x M Project dlmoore30 X U

ID: 642837 • Letter: 4

Question

4ijacksoneng.ua.edu/ x egg com x The University of Ala x M Project dlmoore30 X UA ackson engua.edu C jackson eng.ua.edu/courses/ece285/assignments/dp1.pdf ECE285: Design Project Electronic Component Color Codes 1, Electronic Color Codes Electronic color codes are used to indicate Yalugs or ratings of through hole giggtronic components including resis capacitors, and inductors. Similarly, surface mount components use a numbering scheme to identify value and rating information. Standard through-h resistor color coding uses a series of color bands to identify th resistance value as well as a tolerance value as shown in Figure 1 lst Band -Tolerance 2nd Band- Multiplier Figure 1. Resistor Color-Coding Bands Band A is the first significant figure of the component value. Band B is the second significant figure, and band C is a decimal multiplier. Band D (if present) indicates the tolerance of the value in percent (no band implies 20% tolerance) Table 1 gives the standard Golor code for the four bands. Color Significant Multiplier Tolerance figures Black Orange 3 10. Yellow 4 teen 5 Blue 6 x101 Violet 7 x10' x10. White 9 x x10' Gold x10rt 15% Silver x104 t10%. None 120% Table 1. Resistor Color Codes. For example, a resistor with bands of yellow, violet, red, and goldwill have first digit 4 (yellow in Table 1), second digit 7 (violet), followed by 2 (red) zeros: 4.700 ohms. Gold signifies that the tolerance is 5%, so the real resistance could lie anywhere between 4,465 and 4,935 ohms. A You

Explanation / Answer

#include<stdio.h>

int num(char c)
{
    switch(c)
    {
        case 'B': return 0;
        case 'b': return 1;
        case 'R': return 2;
        case 'O': return 3;
        case 'Y': return 4;
        case 'G': return 5;
        case 'u': return 6;
        case 'V': return 7;
        case 'g': return 8;
        case 'W': return 9;
        case 'o': return -1;
        case 'S': return -2;
    }
}

int main()
{
    double r1,r2,r1min,r1max,r2min,r2max,min,max;
    char str1[10],str2[10];

    printf(" Enter the resistor 1 color code : ");
    gets(str1);

    printf(" Enter the resistor 2 color code : ");
    gets(str2);


    r1 = num(str1[0])*10+num(str1[1]);
    r1 = r1*pow(10,num(str1[2]));

    printf(" The R1 resistance value is %g ohms +/- ",r1);

    if(str1[3]=='W')
    {
         printf("5% (%g to %g ohms) ",r1*1.05,r1*0.95);
         r1max = r1*1.05;
         r1min = r1*0.95;
    }

    else if(str1[3]=='o')
    {
         printf("10% (%g to %g ohms) ",r1*1.1,r1*0.9);
         r1max = r1*1.1;
         r1min = r1*0.9;
    }
    else
    {
         printf("20% (%g to %g ohms) ",r1*1.2,r1*0.8);
         r1max = r1*1.2;
         r1min = r1*0.8;
    }


    r2 = num(str2[0])*10+num(str2[1]);
    r2 = r2*pow(10,num(str2[2]));

    printf(" The R2 resistance value is %g ohms +/- ",r2);

    if(str2[3]=='W')
    {
         printf("5% (%g to %g ohms) ",r2*1.05,r2*0.95);
         r2max = r2*1.05;
         r2min = r2*0.95;
    }
    else if(str2[3]=='o')
    {
         printf("10% (%g to %g ohms) ",r2*1.1,r2*0.9);
         r2max = r2*1.1;
         r2min = r2*0.9;
    }
    else
    {
         printf("20% (%g to %g ohms) ",r2*1.2,r2*0.8);
         r2max = r2*1.2;
         r2min = r2*0.8;
    }

   printf(" The calculated series resistance is %g (min) to %g (max) ohms",r1min+r2min,r1max+r2max);

   min= r1min*r2min/(r1min+r2min);
   max = r1max*r2max/(r1max+r2max);

   printf(" The calculated parallel resistance is %g (min) to %g (max) ohms",min,max);


}

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