prob1 HW1 - % this value in a variable called...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Areeje Khalek % 8/19/2009 9:50 PM % Prob1 of hw01 % Script Name: prob1 % Script Variables: % 1. peakTime (double) - The time it takes for the ball to reach its % highest point % 2. max_height (double) - The highest point the ball reaches % % Problem Statement: % Write a script named "prob1" that will calculate the time it takes for % a ball to reach its highest point, as well as the height at that point. % The ball is thrown straight up with an initial speed of 87 m/s. % [Let Gravity, g = 9.81 m/s^2] % The script should compute the following: % a. How long it takes for the ball to reach its highest point. Store
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % this value in a variable called "peakTime". % b. How high the ball rises from the release point. Store this value in % a variable called "max_height". % % knowns and constants g = 9.81; % this is the gravity constant and is in m/s^2 initSpeed = 87; % initial speed of ball i % calculations % formula to be used is 0 = initial speed + (-)gravity(time) peakTime = initSpeed ./ g; % other formula is max height = initial speed(time) - .5(gravity)(time)^2 max_height = initSpeed .* peakTime - .5 .* g .* peakTime .^ 2;...
View Full Document

Ask a homework question - tutors are online