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

Programming aspects to get familiarized with: Ø The use of decision structures Ø

ID: 3614245 • Letter: P

Question

Programming aspects to get familiarized with:

Ø The use of decision structures

Ø The use of repetition structure.

A resistor is a circuit device designed to have a specificresistance value between its ends (see http://en.wikipedia.org/wiki/Resistorsfor more details on resistors). Resistance values are expressed inohms (?) or kilo-ohms (k ?). Resistors are frequently marked withfour colored bands that encode their resistance values, as shownbelow. The first two bands encode the first two significantdigits of the resistance value, the third is a power-of-tenmultiplier or number-of-zeroes, and the fourth isthe toleranceaccuracy, or acceptable error, of the value.

(Source: http://ikalogic.com/beg_1_res_v_c.php)

The table below shows the meanings of each band color. Forexample, if the first band is green, the second is black, and thirdis orange, and the fourth is silver, the resistor has a value of 50X 103 ± 0.1X50X103 ? or 50 ± 5k?.

The Challenge:

Design the algorithm for the software that prompts the user forthe colors of Band 1, Band 2, Band 3, and Band 4 and then displaysthe resistance in Kilo-ohms (C code is NOT accepted for thisquestion). Assume that band 4 can only be Gold or Silver.

a)       Present a main menu tothe user about the following options:

1)       Calculate resistancevalue

2)       Help

3)       Exit

The “help” option presents some information aboutthe program and how to use it, and re-displays the main menuoptions. The “Exit” option terminates the program. The“Calculate resistance value” leads the user to asecondary menu as shown in Step 2.

b)       The secondary menuprompts the user to select the band colors. For example:

1)       Black

2)       Brown

3)       Red

4)       Orange

5)       Yellow

6)       Green

.

.

Please select the color for band 1: 5

Please select the color for band 2: 0

Please select the color for band 3: 3

Please select the color for band 4: 11

The resistance value is: 50 ± 5 k?

Then the program should print back the main menu (Step 1).

Q1=> Make a program in C (.cfile)

Q2=>Write your report using the five steps model for softwaredevelopment :

a)       Step 1: ProblemIdentification and Statement

b)       Step 2: GatheringInformation

c)       Step 3: Test Cases andalgorithm

d)       Step 4: Code orimplementation

e)       Step 5: Test andVerification

f)        Step 6: Userguide

Color

1st band

2nd band

3rd band (multiplier)

4th band (tolerance)

Black

0

0

×100

Brown

1

1

×101

Red

2

2

×102

Orange

3

3

×103

Yellow

4

4

×104

Green

5

5

×105

Blue

6

6

×106

Violet

7

7

×107

Gray

8

8

×108

White

9

9

×109

Gold

×10-1

±5%

Silver

×10-2

±10%

Explanation / Answer

please rate - thanks #include #include #include void resistance(); void help(); void table(); int main() {int i,code=5; while(code>=1) {printf("Select a function ");    printf("1 Calculate resistance value ");    printf("2 Help ");    printf("3 exit ");    scanf("%d",&code);    switch(code)       {       case 1: resistance();               break;       case 2: help();                break;       case 3:                return 0;                 default: printf("invalidinput-retry ");               break;       }     } getch(); return 0;          } void help() {printf("A resistor is a circuit device designed to have "); printf("a specific resistance value between its ends "); printf("(see http://en.wikipedia.org/wiki/Resistors for more "); printf("details on resistors). Resistance values are expressed in "); printf("ohms (?) or kilo-ohms (k ?). Resistors are frequentlymarked "); printf("with four colored bands that encode their resistancevalues, "); printf("The first two bands encode the first two significant digitsof "); printf("the resistance value, the third is a power-of-tenmultiplier or "); printf("number-of-zeroes, and the fourth is the tolerance accuracy, "); printf("or acceptable error, of the value. "); table(); } void table() {printf("Color    1st band   2ndband   3rd band      4thband "); printf("                              (multiplier)   (tolerance) "); printf("Black        0         0        100 "); printf("Brown        1         1        101 "); printf("Red          2         2        102 "); printf("Orange       3         3        103 "); printf("Yellow       4         4        104 "); printf("Green        5         5        105 "); printf("Blue         6         6        106 "); printf("Violet       7         7        107 "); printf("Gray         8         8        108 "); printf("White        9         9        109 "); printf("Gold                             10-1         +-5% "); printf("Silver                           10-2        +-10 "); } void resistance()    {int i,code;     double value,exp,tol=0;     char pm;     table();     for(i=1;i