Question: Please, I need help, I cannot figure out how to scan variables in to the function prototypes! ******This is what the program should look like

Please, I need help, I cannot figure out how to scan variables in to the function prototypes!Please, I need help, I cannot figure out how to scan variables

******This is what the program should look like as it runs but I cannot figure out how to successfully build the code to do such.******in to the function prototypes! ******This is what the program should look

My code:

#define _CRT_SECURE_NO_WARNINGS

#include

#include

#include

float computeSeriesResistance(float R1, float R2, float R3);

float computeParallelResistance(float R1, float R2, float R3);

float computeVoltage(int current, float resistance);

void getInputR(float R1, float R2, float R3);

void getInputCandR(int current, float resistance);

void myInfo();

void displayMenu();

int main()

{

myInfo();

getInputR();

getInputCandR();

displayMenu();

float R1, R2, R3;

float resistance;

int current;

int choice; //get the choice of the user

scanf("%d", &choice);

while (choice != 4) //exit when user gives 4

{

if (choice == 1)

printf("After Computing Series resistance : %f ", computeSeriesResistance(R1, R2, R3));

if (choice == 2)

printf("After Computing Parallel resistance : %f ", computeParallelResistance(R1, R2, R3));

if (choice == 3)

printf("After Computing Volatege : %f ", computeVoltage(current, resistance));

displayMenu();

scanf("%d", &choice);

}

getchar();

return 0;

}

void getInputR(float R1, float R2, float R3)

{

printf("Enter three resistor values: ");

scanf("%f%f%f", &R1, &R2, &R3);

}

void getInputCandR(int current, float resistance)

{

printf(" Enter a current (whole #) and the resisistance (real #): ");

scanf("%d%f", &current, &resistance);

}

float computeSeriesResistance(float R1, float R2, float R3)

{

return R1 + R2 + R3;

}

float computeParallelResistance(float R1, float R2, float R3)

{

float f = (1.0 / R1) + (1.0 / R2) + (1.0 / R3);

printf("%f ", f);

return 1 / f;

}

float computeVoltage(int current, float resistance)

{

return current*resistance;

}

void myInfo()

{

printf("************************************ ");

printf("*\t\t\t * ");

printf("*\\t * ");

printf("*\t\t\t\t * ");

printf("*\t\t\t * ");

printf("************************************ ");

}

void displayMenu()

{

printf("Mini Electrical Circuit ");

printf("-------------------------- ");

printf("-------------------------- ");

printf("1.Equivalant Series Resitance ");

printf("2.Equivalant Parallel Resitance ");

printf("3.Ohm's law: V = I * R ");

printf("4.Exit ");

}

Input Pararmeters: 3 real numbers Output: float Task: Compute the resistance of a serial cicuit with 3 resistors and return it as main should be the first function in your program maini Declare variables as needed. -Invoke the function to display your info in a box of stars. - Prompt the user to enter 3 resistor values, read them into three float variables, r function's output. The formula is Serial Resistance = R1 + R2 R3 Assume R1, R2. R are the resistance values of three resistors: r2. 13 Prompt the user to enter the resistor value, R and the current I in a circuit. -Invoke the function to display the menu of options. a. Input Parameters: 3 real numbers b. Output: float c. Task: Compute and return the resistance of a parallel circuit with 3 resistors o Prompt the user to choose an option. Read it into an variable. Use a switc statement to process the selected option *Invoke somnuSsricaRcaistans0 passing rl, r2, r3 as input "Display the total resistance in main). *Invoke samauteParallcRcsistan0 passing rl, r2, r3 as input "Display the output in mainO. Invoke computeVoltage 0 to compute the voltage, passng R and "Display the voltage in main. o Option-1 and return it as output. The formula is: Resistance-T R1 R2 R3 o Option-2 The Ohm's formula for calculating voltage across the resistor is: V IR. Where V is the voltage: I is the current and R is the resistance. o Option-3 a. b. c. Input Parameters: current as a whole number; resistance as a real number Output: float Task: Compute the voltage using Ohm's formula: V-IR 1nput arguments. o Option-4 Display "Program will end now." o Default: a. Input Parameters: none b. Output: void c. Task: Display Display: "Invalid Option, try again. programmer's info in a box of stars in Grading chart: Function Prototypes(0.5 a. b. c. Input Parameters: none Output: void Task: Display the menu of options. The menu is as follows: Mini Electrical Circuit Intro comments (-1 if missing) display mem Function 1) Equivalent series resistance 2) Equivalent parallel resistance 3) Ohm's Law 4) Exit

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!