Write a
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.
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
to generate a solution
a solution
- write python code for functions:arrow_forwardCreate a function in C language that takes two integers x, and y as the parameters and returns the sum and the absolute difference of both the numbers but the return type of the function should be void. You can add extra parameters to the function but the function should not return anything and should send the required values as well. Test your function for the numbers 10, and 5 inside the main function.arrow_forwardThis is for C++ Design a Boolean function named isPrime(), which takes an integer as an argument and returns True if the argument is a prime number, or False otherwise. Display all of the prime numbers from 1 through 100. The program should have a loop that calls the isPrime() function. 11 Prime Numbers List (15 points) Use CONSTANTS to set the maximum number in the table to 100 and the number of entries per row to 5. Table of prime numbers from 1 to 100 1 2 3 5 711 13 17 19 2329 31 37 41 4347 53 59 61 6771 73 79 83 8997Press any key to continue . . . Experiment: What is the result if the maximum number is changed, for example, to 1000?arrow_forward
- 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…arrow_forwardThe parameters passed to function are .called formal parameters True O Fales Oarrow_forwardProblem taken from LeetCode // Problem Statement : // You are given a string. // Write a function that takes a string as input and reverse only the vowels of a string. // Example : // Sample Input - 1 : // "hello" // Sample Output - 1 : // "holle" // Sample Input - 2 : // "leetcode" // Sample Output - 2 : // "leotcede" class Solution {public: string reverseVowels(string s) { int i = 0 , j = s.size() - 1; while(i < j) { while(i < j && (s[i] != 'a' && s[i] != 'e' && s[i] != 'i' && s[i] != 'o' && s[i] != 'u' && s[i] != 'A' && s[i] != 'E' && s[i] != 'I' && s[i] != 'O' && s[i] != 'U' )) { i++;…arrow_forward
- Need python help running code and others. Functions are ideal for use in menu-driven programs. When the user selects an item from a menu, the program can call the appropriate function. Write a menu-driven program for Burgers. Display the food menu to a user (Just show the 5 options' names and prices - No need to show the details!) Use numbers for the options and the number "6" to exit. If the user enters "6", your code should not ask any other questions, just show a message like "Thank you, hope to see you again!" Ask the user what he/she wants and how many of them. (Check the user inputs) Keep asking the user until he/she chooses the exit option. Use a data structure to save the quantities of the orders. You should use ArrayLists/Array Bags, or LinkedLists/LinkedBags (one or more of them) to save data. Calculate the price. Ask the user whether he/she is a student or a staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.…arrow_forwardIn C++ language only !!arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education