Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that shows the following menu: S[inusoidal Signal] Temperature C[onversion] Q[quit] If you select c or C you should invoke a user

Write a C++ program that shows the following menu:

S[inusoidal Signal] Temperature C[onversion] Q[quit]

If you select "c or C" you should invoke a user define function void convert (double, double, char) to convert all the temperatures between TempMIN and TempMAX entered by the user, from Celsius to Fahrenheit, or vice versa. The user needs to input C or c to convert to Celsius and F or f to convert to Fahrenheit. The following formulas are employed.

F = (9/5)C + 32 C = 5/9(F 32)

S[inusoidal Signal] C[onversion] Q[quit]

Enter your choice: c

You have selected Conversion option.

Enter range of temperatures to convert: 25 35

Enter C or c to convert to Celsius and F or f to convert to Fahrenheit: C

If you select "S or s" You should invoke a user-defined function, double Sine-Wave (void) that shows the values of a sinusoidal voltage generator at certain times and in different output formats. The voltage can be described by the following equation.

Voltage = Vpeak *(sin (2 * p * f * t))

where sin = sinusoidal function from trigonometry

Vpeak = 120 V

f = frequency in Hertz = 1 Hz

t = time in seconds

p = the constant PI from mathematics

The task of Sine-Wave function is to compute and display the Voltage values at time t = 0 seconds through t=1 second at 0.1 second intervals. This function will also prompt the user for output display format: Scientific or Decimal notation.

You should use looping control structures in your program to compute the voltage values and Switch statements to determine the type of output. You will need to use the math library for the sin function, for input and output displays, and libraries to format the output statements. You can also use to access OS commands. You may set an approximate value for PI, preferably as a const value.

For example, this is what you could see when you run your program (feel free to make improvements to the prompts or the output format where you think it is appropriate):

If the user selects q or Q then your program should terminate.

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions

Question

=+5. How do proposal writers use an RFP? [LO-7]

Answered: 1 week ago

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago