Scientific Programming II

ModSim

Kinematics Quiz


Problem 1 (10 Points)

When an object is thrown straight up with an initial velocity of vi (m/s), the object moves up to the extent to which it is able to overcome the pulling down effect of gravity. Hence, the final velocity (vf) of an object moving straight up will be zero. The equations which govern the straight up motion of a particle are as below:

Sy - Vertical distance covered during the straight up motion (meters)

Vi – Initial vertical velocity of straight up motion (m/s)

t - Time of flight (seconds)

Vf – Final vertical velocity at a given value of t

g – Acceleration due to gravity = 9.8 m/s2

Add the following methods to Particle.java from Unit 1:

Your program should ask the user the following input values:

Your program should compute and write the following to the Excel file (File.xls):

When you throw an object straight up, the object reaches a maximum vertical distance at which point it stops momentarily and then begins its descend downward. At the maximum vertical distance, the final vertical velocity of the object is zero. Your program should stop when the final vertical velocity is zero.

Programming Details:
Output
Modeling Straight Up Motion
Initial Velocity of Straight Up Motion in Meters/Seconds?
> 25
Length of Each Time Interval In Seconds?
> 0.25
End of Data Collection

Once the program has completed running, the contents of “File.xls” should be as below:

Time    Height    Velocity
(s)     (m)       (m/s)
0       0         25
0.25    5.94      22.55
0.5     11.28     20.1
0.75    15.99     17.65
1       20.1      15.2
1.25    23.59     12.75
1.5     26.48     10.3
1.75    28.74     7.85
2       30.4      5.4
2.25    31.44     2.95
2.5     31.87     0
If you have lost your Particle.java
public class Particle {
    private double time;
    private static final double GRAVITY = 9.8;

    public Particle()
    {
        this.time = 0.0;
    }

    public void setTime(double time)
    {
        this.time = time;
    }

    public double getHeight()
    {
        return 0.5 * GRAVITY * Math.pow(this.time, 2);
    }

    public double getVelocity()
    {
        return GRAVITY * this.time;
    }
}