Question
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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started