logo Practice-It logo

BJP4 Exercise 2.1: displacement

Language/Type: Java basics escape sequences println
Author: Marty Stepp (on 2016/09/08)

In physics, a common useful equation for finding the position s of a body in linear motion at a given time t, based on its initial position s0, initial velocity v0, and rate of acceleration a, is the following:

s = s0 + v0 t + ½ at2

Write code to declare variables for s0 with a value of 12.0, v0 with a value of 3.5, a with a value of 9.8, and t with a value of 10, and then write the code to compute s on the basis of these values. At the end of your code, print the value of your variable s to the console.

Type your solution here:


This problem asks for bare code. Submit a fragment of Java code as described. Do not write any class or method heading around your code; just write the lines of code that will produce the result described.

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.