[CSC 204] Getting started...
Andrew J. Pounds
pounds_aj at mercer.edu
Sat Sep 27 10:49:13 EDT 2014
I got two text messages from people in the last hour asking about how to
get started with the Programming Assignment 2. If you have not started,
and seem lost, here is what I recommend.
1. Get into Eclipse, create a new project called Programming Assignment 2
2. In that project create a new java class called ShippingCube.java.
Make sure that when you create the class that you DO NOT select the
option to create a public static void main() stub.
3. Create ANOTHER class in the same project called Tester.java. When
you create this one you DO NEED TO select the option to create a
public static void main() stub.
4. You should now have a ShippingCube CLASS to build and a Tester CLASS
with a main to test the ShippingCube object you are going to create.
5. Go into your ShippingCube java file and create an INSTANCE variable
to hold the number of balls.
6. In your ShippingCube java file create a ZERO ARGUMENT constructor
that initializes the instance variable to hold the number of balls
to zero.
7. In your ShippingCube java file create a method that returns the
number of balls (I forget what I called this method in the
programming assignment, but you can look that up). For the sake of
argument we will call it getBallNumber(). Make sure it is an "int"
returning method and that you have a "return" statement at the
bottom of the method.
8. Now get in your Tester program and call the constructor you just
created -- ShippingCube cube1 = new ShippingCube().
9. Then, in your Tester program, print out the number of balls in your
Shipping Cube -- System.out.println(cube1.getBallNumber())
10. Compile and run, if you get zero back you should have a working
connection between your ShippingCube and your tester and you can now
start working on completing the class and testing it to meet the
project requirements.
There are a lot of details to think about in this assignment -- please
don't put it off.
--
Andrew J. Pounds, Ph.D. (pounds_aj at mercer.edu)
Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
http://faculty.mercer.edu/pounds_aj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc204/attachments/20140927/ef1e9080/attachment.html>
More information about the csc204
mailing list