CS173: Intro to Computer Science - Introduction to Primitive Data Types and Expressions Revisited (3 Points)

Developed by Professor Tralie and Professor Mongan.

Exercise Goals

The goals of this exercise are:
  1. To become familiar with the basic structure of a Java program
  2. To write a Java statement
  3. To declare a variable
  4. To manipulate a variable with arithmetic statements
Modify the Driver.java file to print the distance traveled by an object in free-fall for 5 seconds on Earth.

Enter your Ursinus netid before clicking run. This is not your ID number or your email. For example, my netid is wmongan (non Ursinus students can simply enter their name to get this to run, but they won't get an e-mail record or any form of credit)

Netid
Clicking Run below will check your work and, if it passes, will submit your work automatically. You must be connected to the VPN for submission to be successful! You will receive a copy of your code via e-mail, so you'll know that it was submitted if you receive that e-mail! VPN access requires Multi-Factor Authentication, which sends you a code when you log into the network. Instructions on configuring these for your account can be found here.

Driver.java

public class Driver { public static void main(String[] args) { float g = 9.80665; // Gravitational Constant on Earth in m/s /* TODO: Declare a float variable representing the amount of time that an object fell due to gravity. Set this variable to 5 seconds. */ /* TODO: Print out the distance the object was in free-fall, which is (1/2) * g * time^2 */ } }
Driver.main(null);

Output