Swift

Mini Project - Physics...Solved!

A project that dives into the field of kinematics

Kinematics

A physics concept that is commonly applied to the real world is kinematics. This is concept is mainly based on one equation:

Current position = initial position + speed x time + acceleration/2 x time2

or

x = x0 + v0t + at2/2

Challenge

Your challenge is to write a program that can solve for the current position of the car when you know what all the other values are.

We will be using this program to determine how far (the current position) away a car is 5 seconds after it runs a red light. The car starts at a position of 0 (at the red light) with an initial speed (when it crosses the red light) of 20 meters/second. It accelerates at 2 meters/second2.

Correct answer

The correct answer is 125 meters away from the traffic lights. On the next page, we will show you the code we wrote to solve this problem. You should try your best before resorting to our code for the solution.

chevron_up