CSE 1030: Lab 1

Your task in this lab is to implement the PhysicsUtility class. This class provides some physical constants and methods having to do with gravitation and the Earth.

To get started, open Eclipse. (Open a terminal and type "eclipse" - exact capitalization, no quotes - at the command line.) It may ask you to set up a workspace - if so, answer "yes" and choose default options.

The API is here. The PhysicsUtility class is in a package called "lab1", and the first thing you see is the package summary. PhysicsUtility is the only class in this package.

Click on "PhysicsUtility". Now you can see the API that you are to implement.

To get started, create project for the lab: on the menu, select "File > New > Project", and enter the name "Labs", with exact capitalization. (Correct capitalization is important in Java. You can use this project again for future labs.)

Now create the package. In the API, you will see that the package name is lab1. On the menu, select "File > New > Package", and enter the name "lab1".

Now create the class. Within the lab1 package, select "File > New > Class" to create a new Java class, and enter the name "PhysicsUtility". You will now have a blank PhysicsUtility class in the package lab1.

Now, complete the class, following the procecure given in class:

First, copy and paste the headers of all public fields and methods into the class. (There are no public constructors, since this is a utility class.) These are:

Fields:

public static final double G
public static final double radiusEarth
public static final double massEarth

Methods:

public static double gravitationalForce(double m1, double m2, double r)
public static double earthSurfaceForce(double m)

Next, for each element of the class, read the API carefully, and implement each element in accordance with the description.

Finally, consider the constructor: there is no public constructor in the API, so you need to suppress the default constructor by providing a private constructor, as we saw in class.

Before submission, you should write a tester to make sure the class works correctly. A tester should simply contain a main method that calls all the public methods, ensuring that they work correctly, and accesses all the public fields, e.g., printing them to the screen. You DO NOT need to submit your tester; if you do, it will be ignored.

As a check, the gravitational force at the Earth's surface on a 1 kg mass should be: 9.81 kg m/s^2

Once you are satisfied with your class, you will submit it for grading. Open a terminal. Your source file is called PhysicsUtility.java, and should be located in the directory: workspace/Labs/src/lab1/

There are two ways to submit. To submit using the command line, execute:

cd workspace/Labs/src/lab1/
submit 1030 lab1 PhysicsUtility.java

Or submit via the web submission interface: https://webapp.eecs.yorku.ca/submit/

Labs are due on September 22, 2014. Submissions will be graded automatically on the following grading scheme: