Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C Programming Write a program to assist in circuit calculations ( No previous knowledge in circuits is required ) as follows: Create a function

In C Programming
Write a program to assist in circuit calculations (No previous knowledge in circuits is required)
as follows:
Create a function named menu that has no parameters and returns a character. The function
displays the following options:
,R to calculate series resistance (R=R1+R2).
,P to calculate parallel resistance (1R=1R1+1R2).
, to calculate series capacitance (1C=1C1+1C2).
S to calculate parallel capacitance (C=C1+C2).
,V to calculate voltage across a resistor (V=IR).
C to exit.
The function menu should be displayed at the beginning of the program and every time a menu
option is carried out (redisplay the menu to do more calculations). The menu function should
return the user choice to main.
Create a function named validate that has no parameters and that returns a float. The function
repeatedly asks the user for a value until a positive nonzero value is entered, then the function
returns that value.
Create a function named superman that accepts two float parameters and returns a float. This
function returns F(F=F1+F2.
Create a function named batman that accepts two float parameters and returns a float. This
function returns F(1F=1F1+1F2).(Calculate for F)
Create a function named robin that accepts two float parameters and returns a float. This
function returns the product of the two parameters.
After the user selects any of the above options, ask the user for a float value using the function
validate and assign the return of the function to a float variable name v1 in main. Ask the user
for another float value using the function validate and assign the return of the function to a
float variable name v2 in main.
For Option R: Call the appropriate function (either superman or batman) on the values stored in
v1 and v2. Output the return of the function with the values in v1 and v2 in a formatted
statement such as: The series resistance of 2.7ohms and 5.1ohms is 7.8ohms.
For Option P: Call the appropriate function (either superman or batman) on the values stored in
v1 and v2. Output the return of the function with the values in v1 and v2 in a formatted
statement.
For Option T: Call the appropriate function (either superman or batman) on the values stored in
v1 and v2. Output the return of the function with the values in v1 and v2 in a formatted
statement.
For Option S: Call the appropriate function (either superman or batman) on the values stored in
v1 and v2. Output the return of the function with the values in v1 and v2 in a formatted
statement.
For Option V: Call the function robin on the values stored in v1 and v2. Output the return of the
function with the values in v1 and v2 in a formatted statement.
Option x exits.
Prototype every function above main and place the function definition below main (or you
will lose a lot of points).
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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago