/**
 * CS139 - Programming Fundamentals
 * Department of Computer Science
 * James Madison University
 * @version Spring 2016
 */

Class variables vs attributes

Background

In the previous lab, you created a class of immutable objects named CSColor. Today you will explore another immutable class, but also work with a class intending to be changed. That class contains some instance variables (attributes) as well as some class variables (static).

Objectives

The Story

 
 

The premise behind the Men in Black (MIB) series of movies is that there are aliens on this earth who have sought a neutral planet for refuge from conflict elsewhere in the universe. Most are benign and in fact are helpful to society. But some go out of control. The MIB keep track of the aliens, and if warranted, "isolate" or "remove" them from the earth.

A little known fact is that the recent Bridgeforth Stadium addition was partially funded through the MIB, who built a secret detention center underneath the stadium turf. Aliens detained at the JMU location will be found at location 38.435427 latitude, -78.872942 longitude.

Your application will enable MIB to "check in" new alien arrivals and track their whereabouts. Also, it is important that we know how many aliens we are currently tracking in order to determine workforce requirements. Aliens that are eliminated or deported will be removed from these counts.

Instructions

  1. Download a copy of Location.java and MIBLab.txt (the worksheet).

  2. Review the code for Location.java, and answer the corresponding questions in the worksheet.

  3. Download a copy of MIB.java (which contains the main method) and Alien.java (which you will finish).

  4. Review the code for Alien.java, and answer the corresponding questions in the worksheet.

  5. Finish stubbing out each of the methods by adding place-holder return statements. Get everything to compile before moving forward.

  6. Carefully read the description of each of the unfinished methods. In some cases you will alter class variables and instance variables; in others you will alter one or the other; and in some cases you will simply access data.

  7. Fill in the rest of the code in Alien.java. Use MIB.java to test your code.

  8. Compare your output with the correct output (using diff and/or meld).

Submit Alien.java and MIBLab.txt via Canvas by the end of the day.

Acknowledgments

This lab was originally developed by Nancy Harris, with contributions by Chris Mayfield and David Bernstein.