Question: For this lab, a code should be created to achieve two goals. 1 . Input the color of the bands on the resistor and output

For this lab, a code should be created to achieve two goals.
1. Input the color of the bands on the resistor and output the resistance.
2. Input the desired resistance and output the band colors.
This code can then be used by any engineer who needs to determine the resistance of a given resistor or
select the correct resistor based on the band colors. Here the focus will be on 4 band resistors, but you should
consider how you might update your code to work for a 5 band resistor as well.
Determine if the user will be inputting band colors or the resistance value. If the user chooses to input
band colors, go to step 2; if the user selects resistance value go to step 3.
2. Ask the user for their input. For a 4 band resistor, consider only the first three bands; this code will not
output the tolerance indicated by the 4th band. To make things easier, the user should input the colors
as a string array. E.g.[red,blue,grey].
a. Using conditional statements, convert these values from colors to the appropriate numerical
values as shown on the table.
b. Create a formatted output that displays the resistance value for the input colors
3. Ask the user for their input. For a 4 band resistor, the max value we expect would be 99\Omega . To make
things easier, the user should input the value as a numerical array separating each digit. E.g. a
resistance of 5500\Omega should be input as [5,5,0,0].
a. Using conditional statements, convert these values from numbers to the appropriate colors as
shown on the table.
b. Create a formatted output that displays the band colors for the user input resistance value.\table[]
 For this lab, a code should be created to achieve two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!