Question: For Part-1, you are to develop one main looping program for determining the color-code of a given resistor value. 1. Open Code::Blocks and start a

For Part-1, you are to develop one main looping program for determining the color-code of a given resistor value.

1. Open Code::Blocks and start a new console application project.

2. Create function prototypes at the top of your file for the following functions: a. void prompt(void); b. void calcResistorColors(int);

3. The source code for each of your functions should be written below your main() function. Optionally, if you would like to get more practice with libraries (Part 2), you could create a Resistance Library.

4. Description of the prompt(void) function: a. This function should display the Color-Code Scheme displayed in Table 1 then ask the user what resistance should be color-coded. To save you time, the print statements for Table 1 have been provided to you in Appendix-B

5. Description of calcResistorColors (int) function: a. This function should take, as a parameter, an integer value of a resistor. For the sake of simplicity, we will ignore the tolerance (4th band) and fractional multipliers of Gold and Silver in the 3rd band in this step, so the integer should only be between 1-99M ohms. Make sure to error check this before proceeding. Assuming a valid integer, determine what the 3-band colors would be for this integer, using a leading-0 as necessary, and print the color code to the console window. i. Example: Entering 57000 should output Green-Violet-Orange to indicate 5-7-*1,000. b. HINT: Consider making a getIntBetween() function that sets a min and maximum value to retrieve values between and returns a valid integer. c. HINT: Consider determining what multiplier is being used before determining what digits are present in the first two bands. You can accomplish this by counting the number of times the number can be divided by 10 before it itself is less than 100 (a two-digit number).

6. Your main() function should do the following: a. Call the prompt() function to request user input. b. Perform the conversion and print to the screen. c. Ask the user if they would like to try another resistor i. If yes, loop back to step A ii. If no, exit the program

7. Error Checking: All points of user input should be carefully error-checked to ensure there is no chance for invalid, malicious input. For example, if the program is expecting an integer between 1-99M, entering a negative number or a number too large should fail and ask them to try again. Likewise, entering a character when an integer is expected should not break the program.

For Part-1, you are to develop one main looping program for determining

this is the code to produce table 1

Appendix-B: Print Statements for Table 1 - printf(" -Resistor Codes---- printf("Character Color Band 1 & 2 Band 3 printf(" K | Black 1 *1 printf(" N | Brown 1 1 *10 I "); printf(" R Red 2 *100 1 "); printf("! | Orange 3 *1,000 1 "); printf(" Y | Yellow 4 1*10,000 1 "); printf(" G Green 5 *100,000 printf(" B 1 Blue 1 6 *1,000,000 1 "); printf(" V | Violet 7 1*10,000,000 "); printf(" E | Grey 1 8 I "); printf(" W | White 1 9 printf(" D 1 Gold 1 printf(" | Silver I "); printf( - "); 0 000 UNPOP

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!