Challenge 44

🚗

SUVAT - Equations of Motion

Open in Code Editor or Copy Instructions
...solutions at bottom of page...

To calculate an objects motion (ignoring external forces like friction/air resistance), we can use the SUVAT equations as shown in the image here

Note how with 3 known values, you are able to solve the other 2

Create a program that gets the user to input 3 of the values and calculates the other 2. How you do this is up to you. You could give them a menu and ask them to choose 1 of the 5 equations, then ask for their inputs...or you could ask them to enter each of the values, with values they leave empty being the unknowns (note: you'd have to ask for these inputs as strings & convert them, since there is no way to determine between an empty integer input (0) and a legitimate entry of 0 (e.g. 0 initial displacement, speed or time))...or you could allow the user to enter a string like u=0,v=100,t=20 and parse it yourself

You can use a site like this to check your answers:

Examples:

Inputs of u=0, v=100, t=20 would output s = 1000m, a = 5m/s

Inputs of s=500, u=-50, v=100 would output a = 7.5m/s**2, t = 20s

Extension:

Rather than having multiple different input prompts, allow the user to enter all their values at once in a form like u=0,v=100,t=20

Solutions

IGCSE 0478 / O-Level 2210 A-Level 9618