ICS 111, Introduction to Computer Science
Lab 14 - Creating Objects - November 4

This lab will help by practicing:


To receive credit for this lab assignment, you must be finished by Thursday, November 6, at 11:59 p.m.   After this time you will not receive any credit.  There will be only one lab this week.


1.  Login to UNIX

2.  Create and edit a Java program in Pico to do the following:


public class CardHolder{

  // instance variables
  private String sName;
  private int iCardNum;
  private double dBalance;


  //this first constructor adds by default $20 to the balance //as annual fee.
  public CardHolder(String sName, int iCardNum){

  } //constructor

  //this second constructor does not add an anual fee
  public CardHolder(String sName, int iCardNum, double dBalance){

  } //constructor


  public int getCardNumber( ){    //returns the card number (iCardNum)


  public String getName( ){         // returns the String sName


  public double getBalance( ){    // returns the balance dBalance


  //set methods

  public void setCardNumber(int newCardNumber ){    // sets a new CardNumber iCardNumber


  public void setName(String sName){                            // sets a new Name sName


  public void setBalance(double newBalance){            // sets a new balance dBalance


  //other methods

  //returns a printable version of the object
  public String toString( ){


  //compares two cardholder objects
  public boolean equals(CardHolder otherCardHolder){


}// class CardHolder

3.  Compile and run the program.  Be sure to thoroughly test the program after getting it compiled and running to make sure it meets ALL of the requirements above.

4.  Get into Pine, and attach the file to an e-mail

5.  Send the e-mail / file(s) to the ics111-lab@hawaii.edu account.

6.  Check the webpage to make sure that the e-mail arrived.  Note that this will be sent to the ICS 111 lab address (ics111-lab@hawaii.edu).  This one is different from the ics111-homework@hawaii.edu.  There are two different ones so we can have homework assignments and lab assignments separate.

Here is the URL:

7. Once I (TA) get the e-mail in my account AND I can verify it on the web, your lab assignment will be graded.  For grading policies on your lab, click here...

Link to the Java API -  to look up any methods of any class you would like to use.

Link to the Java Coding Standard -  to look up Java code formatting rules.