Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Write a program to calculate the arithmetic mean, the geometric mean, and the Assignment 8 While Loops Due Tuesday, November 7, 2017 harmonic mean
2. Write a program to calculate the arithmetic mean, the geometric mean, and the Assignment 8 While Loops Due Tuesday, November 7, 2017 harmonic mean for a set ofnon-zero numbers. Ask the user to enter values for the numbers between 0 and 10 and enter -99 when they are done. Within the sentinel loop calculate the required sums and product. Use doubles for the variables. For each of the programs assigned below, submit the following artimenc mean Hard copy of th .Hard copy of sample executions (black or, preferably, white screen). . Copy of the source code (csaved as an electronic attachment Assignment 8 e source code located in Canvas under Assignments. Observe the usual guidelines regarding the initial comment section, indenting, and so on. In addition, anmonic mean Indent statements within loops. 1. The height h of a ball thrown upward at an angle A with initial velocity v, is given by the following formula: Calculate the means after exiting from the loop and print using 3 decimal digits Test with 7.3, 3.0.9.2. 4.6. 5.5 Suppose in a given situation a table of values of time t and height h are to be printed in a table beginning at time 0 and continuing at intervals of 0.05 sccond until the ball reaches the ground. Use preprocessor commands to define g with a value of 9.81 and pi witha value of 3.14159. In function main, prompt the user to input first the initial velocity v0 (a value between 10 and 15 meters per second inclusive) and then the angle of launch (a value between 30 and 60 degrees inclusive). Use while data validation loops to assure that the initial velocity and angle of launch are each in the proper range. (Hint: You will validate each variable separately) Call a function to print a labeled table of values of time t and height h, beginning at time 0 and continuing at intervals of 0.05 second until the ball reaches the ground. The function will have as parameters the initial velocity and the angle of launch and will not return a value. In the function use a while loop and print the values one line at a time within the loop, placing time in the column on the left and height in the column on the right Do not print any negative values of height Use 2 digits after the decimal point for time and 2 digits after the decimal point for height Test with initial velocity of 14 m's and angle of launch of 50 degrees. (Note: Include the math.h header file to make the function sin(A) available. Make sure you convert degrees to radians.)
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