Write a program to provide information on the height

Assignment Help Computer Engineering
Reference no: EM132113579

PYTHON. Projectile Motion

Write a program to provide information on the height of a ball thrown straight up into the air. The program should request as input the initial height, h feet, and the initial velocity, v feet per second. The height of the ball after t seconds is h + vt - 16t 2 feet.

The program should perform the following two calculations:

(a) Determine the maximum height of the ball. Note: The ball will reach its maximum height after v/32 seconds.

(b) Determine approximately when the ball will hit the ground. Hint: Calculate the height after every .1 second and determine when the height is no longer a positive number.

A function named getInput should be used to obtain the values of h and v and that function should call a function named isValid to ensure that the input values are positive numbers. Each of the tasks (a) and (b) should be carried out by functions.

This is what I have with errors:

def main():
h = getInput()
v = getInput()
maxH = maxHeight(h,v)
ballT = ballTime(h,v, t)
print("The maximum height of the ball is", maxH, "feet.")
print("The ball will hit the ground after approximately", ballT, "seconds.")

def getInput():
h = (input("Enter the initial height of the ball: "))
v = (input("Enter the initial velocity of the ball: "))
isValid(h,v)

def isValid(h,v):
if ((h<= 0) or (v <= 0)):
print("Please enter positive values")
getInput()

else:
maxHeight(h,v)


def maxHeight(h,v):
t = (v/32)
maxH = (h + (v*h) - (16*t*t))
return maxH


def ballTime(h,v, t):
t = 0
ballHeight = (h + (v*t) - (16*t*t))
while (ballHeight >= 0):
t += 0.1

return t

main()

Reference no: EM132113579

Questions Cloud

Mean anxiety score in elementary school children : The mean anxiety score in elementary school children is 14.55. A researcher wants to know if children of anxious parents are more anxious than the average child
Write a program that counts how often each word occurs : Write a program that counts how often each word occurs in the supplied text file mary.txt.
What is the probability that the coin you picked is the fair : Given this information, what is the probability that the coin you picked is the fair one?
Write a function to append lines to a file : Write a function to append lines to a file. Do this in a loop that would allow the user to continue adding lines to a file until they enter the letter q.
Write a program to provide information on the height : Write a program to provide information on the height of a ball thrown straight up into the air.
Determine whether the effect of one variable : Suppose you are trying to use linear regression analysis to determine whether the effect of one variable, X1, on another variable, Y, depends upon
Write a program that opens a specified text file : Write a program that opens a specified text file and then displays a list of all the unique words found in the file.
A program that asks the user to enter a word : Write a program that asks the user to enter a word. The program then reads ‘The Raven' by Edgar Allen Poe from a text file, and returns the number of times .
Stochastic processes-branching process : Let {Xn : n 1} be a branching process with X0 = 1 whose offspring ??? distribution has mean µ =E(???) ??? (0, ?8? ).

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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