Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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[]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What do you think?

Answered: 1 week ago