Write a short program to simulate a ball being dropped

Assignment Help C/C++ Programming
Reference no: EM13860505

This one is a little more challenging. Write a short program to simulate a ball being dropped off of a tower. To start, the user should be asked for the initial height of the tower in meters. Assume normal gravity (9.8 m/s2), and that the ball has no initial velocity. Have the program output the height of the ball above the ground after 0, 1, 2, 3, 4, and 5 seconds. The ball should not go underneath the ground (height 0). Your program should include a header file named constants.h that includes a namespace called myConstants. In the myConstants namespace, define a symbolic constant to hold the value of gravity (9.8). See section 2.9 -- Symbolic constants and the const keyword for a reminder on how to do this. Use a function to calculate the height of the ball after x seconds. The function can calculate how far the ball has fallen after x seconds using the following formula: distance fallen = gravity_constant * x_seconds2 / 2 Sample output: Enter the initial height of the tower in meters: 100 At 0 seconds, the ball is at height: 100 meters At 1 seconds, the ball is at height: 95.1 meters At 2 seconds, the ball is at height: 80.4 meters At 3 seconds, the ball is at height: 55.9 meters At 4 seconds, the ball is at height: 21.6 meters At 5 seconds, the ball is at height: 0 meters.

Reference no: EM13860505

Questions Cloud

Question regarding the bronsted-lowry acid : Problem: When styrene (below) is dissolved in a strong Bronsted-Lowry acid (like HCL), it can be protonated on either of the two carbons in the vinyl substituent, to form two isomeric strong electrophiles (carbocations). (Assume the aromatic C=C π..
The issuance of these bonds : Lauren Corp. is planning to raise additional investor capital by issuing bonds. The company wants to raise $700,000 using bonds with a $1,000 face value. The bonds will mature in 12 years, carry a coupon interest rate of 7.25%, and will pay interest ..
Evaluate the given problem of data types : Comprehensive quiz 1) Evaluate the following: a) (5 > 3 && 4 6 && true) c) (3 >= 3 || false) d) (true || false) ? 4 : 5.
No amortization charges : The balance sheet and income statement shown below are for Greshak Inc. Note that the firm has no amortization charges, it does not lease any assets, none of its debt must be retired during the next 5 years, and the notes payable will be rolled over.
Write a short program to simulate a ball being dropped : Write a short program to simulate a ball being dropped off of a tower. To start, the user should be asked for the initial height of the tower in meters.
What should america learn from the declining tfr of puerto : What is the ideal family size in the USA according to Gallup Poll and the General Social Survey?
Write program that user ask to enter floating point numbers : Write the following program: The user is asked to enter 2 floating point numbers (use doubles). The user is then asked to enter one of the following mathematical symbols: +, -, *, or /.
Why are symbolic constants usually a better choice : Why are symbolic constants usually a better choice than literal constants? Why are const symbolic constants usually a better choice than #defined symbolic constants?
What division of the atmosphere is most important to man : Name three controls of weather and climate.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Asignment1questionwrite a recursive function void reverse

assignment1questionwrite a recursive function void reverse that reverse a sentence.for examplesentence greeting new

  Program reads the contents of employees

Design a program that reads the contents of the employees.dat file and prints all the data within it. Format the report as designated in the Printer Spacing Chart below.

  Provide a three-argument constructor

Create a class called Point that has two data members: x- and y-coordinates of the point. Provide a no-argument and a 2-argument constructor - Provide a three-argument constructor

  Create a program that maintains the required book catalog

Create a program that maintains the required book catalog for the circulation desk of a library.

  Sort an array of elements using the quick sort algorithm

Sort an array of 10,000 elements using the quick sort algorithm as follows: sort the array using pivot as the middle element of the array

  How many generations do you want to wait

How many generations do you want to wait? How many jackalopes do you have?

  Modify the circuit of figure by rewriting the pld program

Modify the circuit of Figure by rewriting the PLD program to address memory in locations A0000H-BFFFFH for the ROM

  Consider the following nested loop construct

Consider the following nested loop construct. Categorize its efficiency in terms of the variable n using big-O notation. Suppose the statements represented by the ellipsis require four main memory accesses (each requiring one microsecond) and two dis..

  How do you generate arrays, random numbers

How do you generate arrays, random numbers and multiply and add rows, columns and diagonals in C

  Using powerpoint, word, visio or any other graphical editor

Using Powerpoint, Word, Visio or any other graphical editor that allows you to create shapes and arrows, create a simple flow chart  that provides the functionality for this pseudocode: Write "Enter the price in dollars: " Input Price

  Write a program that estimates the temperature in a freezer

Write a program that estimates the temperature in a freezer (in degrees C) given the elapsed time (hours) since a power failure. Assume this temperature (T) is given by

  Pros and cons of choosing two servers

Classify the two alternatives in terms of what type of application architecture they use. b. Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd