Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C/C+ program that will determine the resistance value (in ohms or k Ohms) of a carbon or metal film resistor (ranging from 1/8

image text in transcribed

Write a C/C+ program that will determine the resistance value (in ohms or k Ohms) of a carbon or metal film resistor (ranging from 1/8 to 5 watts) when the program user inputs the three colors of the resistors color band. Your program should accept the following characters as string variable inputs for the three resistor color bands: BLACK = 'B' (0 for bands one or two and pow(10, 0) for band three) BROWN = 'b' (1 for bands one or two and pow(10, 1) for band three) RED = 'R' or 'r' (2 for bands one or two and pow(10, 2) for band three) ORANGE 'O' or 'o' (3 for bands one or two and pow(10, 3) for band three) YELLOW = 'Y' or 'y' (4 for bands one or two and pow(10, 4) for band three) GREEN = 'G' (5 for bands one or two and pow(10, 5) for band three) BLUE = 'U' or u' (6 for bands one or two an pow(10, 6) for band three) VIOLET = 'V' or 'v' (7 for bands one or two, not used in band three because the color code only includes resistors less than 100 M ohms) GRAY = 'g' (8 for bands one or two not used for band 3) WHITE = 'W' or 'w' (9 for bands one or two, not used for band three) Your code should use either switch-case statements or if - else if loops. Your program should be able to calculate the resistor value after the user enters the characters corresponding to the three colors of resistor color bands: then display the numerical value of resistance on the screen. For example, if the user enters 'o', then 'r' and finally 'b'; then the corresponding resistor value to print out would be 32 * pow(10, 1), or 320 ohms. If the user entered 'b', 'y' and 'G' then the corresponding resistor value would be 14 * pow(10, 5) or 1400000 Ohms or 14 M ohms After writing this program, test it by typing in following three color bands as inputs: Red - green-blue Yellow - grey - black White - orange - brown

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

What is cost plus pricing ?

Answered: 1 week ago

Question

1. What are the types of wastes that reach water bodies ?

Answered: 1 week ago

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago