General math) a. Write a C++
b. How do you know the midpoint values your program calculates are correct?
c. After verifying the output your program produces, modify it to determine the midpoint coordinates of the line connecting the points (2,10) and (12,6).
d. If your program doesn’t already do so, change its output to this:
The x coordinate of the midpoint is xxx.xx
The y coordinate of the midpoint is xxx.xx
The xxx.xx denotes placing the calculated value in a field wide enough for three places to the left of the decimal point and two places to the right of it.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
C++ for Engineers and Scientists
- (Electrical eng.) a. The voltage gain of an amplifier is given by this formula: voltagegain=[275 23 2 +0.5 f 2 ]n f is the frequency in Hz. n is the number of stages in the amplifier. Using this formula, write, compile, and run a C++ program to determine the value of the voltage gain for a four-stage amplifier operating at a frequency of 120 Hz. Your program should produce the following display: At a frequency of xxxxx hertz, the voltage gain is yyyyy Your program should replace xxxxx with the frequency and yyyyy with the voltage gain. b. Manually check the value your program produces. After verifying that your program is working correctly, modify it to determine the voltage gain of a 12-stage amplifier operating at a frequency of 9500 Hz.arrow_forward(a) {w|w contains a 1 after a 0 and before another 0} (b) {w |w does not contain the substring 00} (c) {w |w contains an odd number of 1s or exactly one 0} 2. Use the algorithm you learned in class to convert the following NFA to an equivalent regular expression. a, A Poarrow_forwarduse python codearrow_forward
- Q.2. [Arithmetic Operators] Write a program to: (C++ Language) Find the product of two numbers. Convert the temperature from Farenheit to Celsius Compute and Display the average of 4 subject marks.arrow_forwardProblem 4. (Regular Expressions-using Python re or Java regex) Write a regular expression for the following word patterns: 1. Word starts with a 'q'. Word has 'th'. 2. 3. Word has an 'q' or a 'Q'. 4. Word starts with an 'q' or an 'Q'. 5. Word has both 'o' and 'u' in it. 6. Word does not have an 'a'arrow_forwardIts c++ do it in a easy wayarrow_forward
- 03: Write a C++ program to obtain the value of the sine function for any angle (x) according the fallowing 02: Detect the errors (at least 8) in the following C++ program: #include int i, j. array[5 51, max!; for ( i 0, i<=5, it+) for ( j=0, j<=5, j++); 1 if (array [i,j)arrow_forwardC++ Answer quickly pleasearrow_forward(General math) Write, compile, and run a C++ program to calculate the distance between two points with the coordinates (7, 12) and (3, 9). Use the fact that the distance between two points with the coordinates (x1, y1) and (x2, y2) is given by this formula: distance=(x2+y2) After verifying that your program works correctly by calculating the distance between the two points manually, use your program to determine the distance between the points (-12, -15) and (22, 5).arrow_forwardPlease solve it with setw and endlarrow_forward-) Write a complete C++ program that takes the users' weight and their lifestyle as an input and recommends the number of calories they should take per day. Your program needs to take users' weight as an integer value and their lifestyle as a character that shows if they are active (a) or sedentary (inactive) (s). Your program then calculates the number of calories by multiplying the users' weight with the activity factor. If the person is sedentary, that person's activity factor is 13. If the person is active, that person's activity factor is 15. Sample Run Please enter your weight: 60 Do you have an active (a) or sedentary (s) lifestyle? s The recommended number of calories: 780arrow_forward(a) Using the program above, Compute a monthly tax (in Namibian Dollars) payableby an individual earning N$980, 953 per annum, with a tax free monthly allowanceof N$15, 000. NB: Your answer to this question should be presented as a commentat the end of the main code, with all details.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr