Write a program in C 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 functiondisplays the following options:- R to calculate series resistance (R = R1 + R2).- P to calculate parallel resistance (1/R = 1/R1 + 1/R2).- T to calculate series capacitance (1/C = 1/C1 + 1/C2).- S to calculate parallel capacitance (C = C1 + C2).- V to calculate voltage across a resistor (V = I x R).- C to exit.The function menu should be displayed at the beginning of the program and every time a menuoption is carried out (redisplay the menu to do more calculations). The menu function shouldreturn the user choice to main.Create a function named validate that has no parameters and that returns a float. The functionrepeatedly asks the user for a value until a positive nonzero value is entered, then the functionreturns that value.Create a function named superman that accepts two float parameters and returns a float. Thisfunction returns F ( F = F1 + F2).Create a function named batman that accepts two float parameters and returns a float. Thisfunction returns F ( 1/F = 1/F1 + 1/F2). (Calculate for F)Create a function named robin that accepts two float parameters and returns a float. Thisfunction 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 functionvalidate and assign the return of the function to a float variable name v1 in main. Ask the userfor another float value using the function validate and assign the return of the function to afloat variable name v2 in main.For Option R: Call the appropriate function (either superman or batman) on the values stored inv1 and v2. Output the return of the function with the values in v1 and v2 in a formattedstatement such as: The series resistance of 2.7 ohms and 5.1 ohms is 7.8 ohms.               For Option P: Call the appropriate function (either superman or batman) on the values stored inv1 and v2. Output the return of the function with the values in v1 and v2 in a formattedstatement.For Option T: Call the appropriate function (either superman or batman) on the values stored inv1 and v2. Output the return of the function with the values in v1 and v2 in a formattedstatement.For Option S: Call the appropriate function (either superman or batman) on the values stored inv1 and v2. Output the return of the function with the values in v1 and v2 in a formattedstatement.For Option V: Call the function robin on the values stored in v1 and v2. Output the return of thefunction 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program in C 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 (1/R = 1/R1 + 1/R2).
- T to calculate series capacitance (1/C = 1/C1 + 1/C2).
- S to calculate parallel capacitance (C = C1 + C2).
- V to calculate voltage across a resistor (V = I x R).
- 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 ( 1/F = 1/F1 + 1/F2). (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.7 ohms and 5.1 ohms is 7.8 ohms.

 
 
 
 
 
 
 
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
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education