Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Must be written in Basic C only, Not C++ Create a calculator program as follows. Create a menu function ( function should display the menu

Must be written in Basic C only,

Not C++

Create a calculator program as follows.

Create a menu function ( function should display the menu options and return the user selection with the following options:

1 to calculate the number of real solutions for a quadratic equation

2 to calculate the resistance in series for two or more resistors

3 to calculate the resistance in parallel for two or more resistors

4 to calculate power drop across resistors in series

5 to calculate power drop across resistors in parallel

6 to exit program

Repeatedly display the menu after each calculation until option 6 is entered.

Option 1:

Ask the user for and store the three numerical coefficients of a quadratic equation and store them in three float variable.

Write a function named root which takes the three coefficients as arguments and return the number of real roots as 2, 1, or 0. Call the function root and pass the user inputs as arguments, then, output a statement indicating the number of roots according to the function return values.

For a quadratic equation in the form ax2 + bx + c = 0, calculate the value of sqrt(b2 4ac) and if it is:

Negative zero solutions

Zero one solution

Positive two solutions

Option 2:

Ask the user for the resistor value one resistor at a time.

Write and use a function called res_series that takes two resistors in series and return the total resistance. Rseries = R1+ R2 + R3 + ..

Keep adding the resistor values by calling res-series until the user enters zero or negative value, then display the total resistance.

Option 3:

Ask the user for the resistor value one resistor at a time.

Write and use a function called res_parallel that takes two resistors in parallel and return the total resistance. Rparallel =1 / R1 + 1 / R2 + 1 / R3 + ..

Keep adding the resistor values by calling res-parallel until the user enters zero or negative value, then display the total resistance.

Option 4:

Ask the user for and store the voltage across the resistors. Ask the user for the series resistance one value at a time and use the function res_series to calculate the total resistance.

Create and use a function named current that takes two parameters, one for voltage and the other for resistance, this function returns the current according to the following OHMs law equation: V = I R.

Create and use a function named power that takes two parameters, one for voltage and the other for current, this function returns the power drop according to the Power rule: P = I V.

Output the power drop to the screen.

Option 5:

Ask the user for and store the voltage across the resistors. Ask the user for the parallel resistance one value at a time and use the function res_parallel to calculate the total resistance.

Use the function current to calculate the current.

Use the function power to calculate the power drop.

Output the power drop to the screen.

Option Z or z: exit the program.

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

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago