The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
C++ programming labs
Â
1: Project 15: Speed of Sound. Sound travels through air as a result of collisions between the molecules in the air. The temperature of the air affects the speed of the molecules, which in turn affects the speed of sound. The velocity of sound in dry air can be approximated by the formula:
     velocity = 331.3 + 0.61 A????1 T
where Tc is the temperature of the air in degrees Celsius and the velocity is in meters/second.
Write a program that prompts the user for a starting and an ending temperature. Within this temperature range, the program should output the temperature and the corresponding velocity in one degree increments . In the example below, the user entered 0 as the start temperature and 2 as the end temperature:
Enter the starting temperature, in degrees Celsius: 0
Enter the ending temperature, in degrees Celsius: 2
At 0 degrees Celsius the velocity of sound is 331.3 m/s
At 1 degrees Celsius the velocity of sound is 331.9 m/s
At 2 degrees Celsius the velocity of sound is 332.5 m/s
Input Details: The input will consist of two integers , both responses to program prompts.
Output Details: The program uses the prompts shown in the example above. The output percentage must have one digit past the decimal point.
Â
2:Project 12: Ancient square root algorithm. The Babylonian algorithm to compute the square root of a number n is as follows:
     1. Make a guess at the answer (you can pick n/2 as your initial guess).
     2. Compute r = n / guess
     3. Set guess = (guess + r) / 2
     4. Go back to step 2 for as many iterations as necessary.
       The more that steps 2 and 3 are repeated, the closer guess
       will become to the square root of n.
Write a program that inputs an integer for n, iterates through the Babylonian algorithm until guess is within 1% of the previous guess, and outputs the answer as a double .
Input Details: The input will consist of a single integer . It is prompted for by the string "Enter number to compute the square root of."
Output Details: The program prints the label "The estimate of the square root of X is" followed by the estimate of the square root, where X is the number read in whose square root is being estimated. All numerical values should be printed with exactly two digits past the decimal point.
3:Project 19: Class scores Write a program that calculates the total grade for N classroom exercises as a percentage. The user should input the value for N followed by each of the N scores and totals. Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage. sample input (in bold) and output (in italics) is shown below.
How many exercises to input? 3
Score received for exercise 1: 10
Total points possible for exercise 1: 10
Score received for exercise 2: 7
Total points possible for exercise 2: 12
Score received for exercise 3: 5
Total points possible for exercise 3: 8
Your total is 22 out of 30, or 73.33%.
Input Details: The input will consist of an initial integer (let's refer to it as N) followed by N pairs of integers , all responses to program prompts.
Output Details: The program uses the prompts and labels shown in the example above.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll