Comp 152 Project 1:
Review of Comp 151

Objective: to review many of the key concepts of comp151 to refresh your programming knowledge and get everyone ready for this semesters programming projects on new topics.

Due: Feb 10th at 11:59pm


In this project you will write a program which will be a simplified version of software to run the card access doors in a building like the science building. 


Go to the moodle page for the class and download the three starter files. You will find the sample input file and two programming files. They won't compile immediately because they rely on one of the classes you will write below. Import and into your implementation of this project. Put lockDataBase.txt into your working directory. (In eclipse this is the main project directory, when using the command line, this is the folder with the object files in it.

You will need to write two classes. The first class will be called LockData and store data about whether a particular card has access to a series of locks.

LockData must store the following information (this will be private so you can represent this however you like:
you must also make the following method available:

public boolean checkDoorPermissions(int doorNumber)

behavior: This method will take an integer from 0 to 7 representing one of 8 doors. It will return true if this card's owner (this object) should open the door numbered doorNumber. The method should return false otherwise. Of course you will need other methods like constructors and accessor methods, but just fill in those that you need.

Your second class must be called LockDataBase. It needs to:
  1. have a collection (either an Array or an ArrayList, your choice) of LockData objects. If you go with an array make sure you can handle at least 25 elements.
  2. have a method which will read from a file named lockDataBase.txt (note that when I grade I will add additional lines to the sample file I'm giving you with this assignment.
    1. After the user reads each line of the file into the program, make a LockData object out of the line and put it into your array.
  3. Call your method for reading from the file in your constructor for the LockDataBase class. You must provide a zero parameter constructor.
  4. Provide the following method as part of your LockDataBase class
    public boolean canOpenDoor(int cardNumber, int doorNumber)


Include a readme.txt text file in your project. For this project the readme.txt should include

When you are ready to submit your project zip up the folder with the java code, your sample input file and your readme and upload them to moodle.