Monthly Archives: December 2013


Monsoon rains have created a lake in the middle of Santong Island.  Furthermore, that lake contains an island. Two Jeroos were separated by the rains.  One is on the main part of Santong Island, but the other is on the island in the middle of the lake.  The goal of this program is to have each Jeroo explore the shoreline of the lake.

  • Each Jeroo starts with one flower and the lake immediately to its right.
  • Each Jeroo starts by planting a flower then traveling, keeping the lake on its right, until it returns to the flower. The Jeroo then picks the flower.
  • (only plant 1 flower, at starting point…and make 1 lap until you are back at that flower)
  • Have the Jeroo on the main part of Santong Island walk the shore first.
  • then have the one on the lake’s island walk the shore

Download Walk the Lake  (This has several maps, choose any 1)






This problem is adapted from one that was created originally by Erica Eddy of The University of Wisconsin – Parkside.


Or you can try walk the lake using loops using this map and Jeroo assignment


Scavenger Hunt and relay race

Relay Race

Download both island files.

Objective: Three Jeroos (you give them names) are practicing for the Santong Relays. Figure 5 shows the course at the start of the race. The first Jeroo begins at (4,9) facing EAST. It must pick the flower and give it to the second Jeroo who begins at (7,13) facing NORTH. The second gives the flower to the third Jeroo who begins at (4,15) facing WEST. The third Jeroo must plant the flower at (3,16), run to (3,21) and stop

Scavenger Hunt


      Two Jeroos start at opposite ends of Long Island, one at (3,5) facing EAST, and one at (5,18) facing WEST. Each Jeroo is supposed to pick two flowers. The first one can be from anywhere along the edge of the island, and the second must be the one in the center. The first one to pick the center flower is declared the winner. There are a few rules to this scavenger hunt.

    • The Jeroos can only turn LEFT
    • The Jeroos must take turns, each doing only thing in each turn: hop(), turn(LEFT), or pick()
    • A Jeroo can only hop forward one space in its turn.

Download both island files.

Bank Class

Bank Class

You have a lot of flexibility in creating this class, but here is what it should be able to do

  • Methods
    • ArrayList<Person>  topAccountOwners(double cutoff)
      • this method returns an ArrayList of the owners whose accounts have at least cutoff amount of balance
    • void nightlyUpdate()
      • this runs through the accounts and if account is a SavingsAccount, then it calls that object’s recordDailyBalance() method
    • Account topBalance()   ; returns the Account object with the greatest balance
    • Account[] allWithinRange(double min, double max) returns an array of Accounts whose balances range from min  to max , inclusive
    • boolean transfer( double amount, int accountIdFrom , int accountIdTo) ;  this method transfers  money from the one account to the other. If the accountIdFrom  does not have enough $$, this method returns false.
    • void monthlyUpdate()
      • this runs through the accounts and if
      • account is a SavingsAccount, then it calls that object’s updateInterestPayment() method
    • ** extra credit ArrayList<Account> sortByAmount()  
      •   this method returns an arraylist of Accounts sorted by amount in the account




Jeroo Spelling Letters (python)

I.  Copy and paste this code below in the Jeroo “IDE”. Run the code several times unti you understand what is going on, then try experimenting with the code, changing it around until you are comfortable with the basic methods of a Jeroo.




Objective: Have a Jeroo spell out the lettter “Z ” in the same fashion as Part I

Picture of the finished project




Objective: Have a Jeroo spell out the letter “O ” in the same fashion as Part I

Account Abstract Class Assignment

This is the first part of a 2 part project.

Person Class


  • public Person( String _name, int _age)

instance Variables

  • private String name
  • private int age


  • public String  getName()
  • public int compareTo(Person other) { return this.age - other.age; }


Account – Abstract Super Class

Static Variable(s)

  • private static int nextAccountNum
  • private static int parentCompanyCode = 12810  ;


  • public Account( double_balance, Person _owner)

instance Variables

  • private int  accountNumber
  • protected  double  balance
  • protected  ArrayList<Person> owners


  • public static int getParentCode()
  • public int getAccountNumber()
  • public void deposit(double amount)
  • public double getCurrentBalance()
  • public abstract  boolean withdraw(double amount)
  • public boolean equals(Account other) // are the unique account numbers equals ?
  • public String toString()
  • public int comparesTo(Account other) { return this.accountNumber- other.accountNumber }  (Note that this method has an ‘s‘ )
  • public void addOwner(Person p) //adds P to the ArrayList of owners
  • public ArrayList<Person> getOwners()  //  returns the ArrayList of owners
  • public Person remove( Person p) // this emulates the ArrayList’s remove() method (link) . Remember that that method removes the object and then returns the removed object. In this case, you should remove Person P from the ArrayList of owners

  • CheckingAccount extends Account
  • This class has to do certain things. You can decide the best way to do it. This class should have a way to
    • attempt to withdraw money by writing a check
    • public void writeCheck(double amount)
    • public void cancelCheck(int checkNumber)
      • be able to cancel checks and keep track of the check numbers that have been cancelled
      • when a check is cancelled the amount associated with that check is returned back to the balance
  • One solution
    • every time you write a check, you need a new check “#” (static variable like an id)
    • writeCheck( double amount) - > tries to call this.withdraw(double amount)  as long as the balance is enough and records a new check number by adding it to an ArrayList<Integer>  that stores the check numbers of cancelled checks. It would also need a parallel ArrayList<Double>  to store balances (in case the check is cancelled and the amount is refunded to the balance)

SavingsAccount extends Account

  • instance variables
    • private double interestRate
    • private ArrayList<Double> dailyBalances

    static variables

    • public static final int MINIMUM_BALANCE=100;  // this is the absolute minimum amount of money that must always be in the account
  • methods
    • public boolean withdraw(double amount)  //@override the withdraw() method to ensure that currentBalance the never gets below MINIMUM_BALANCE
    • public void recordDailyBalance()  // @ record current day’s balance by storing current balance.
    • public double projectBalance(double timeInYears)  // use the compound interest formula .  Assume that the bank compounds the balance monthly. To learn more about how compound interest really works, click here .
    • public  void updateInterestPayment() // @ once a month update account based on average daily balances and interest rate

CertificateOfDeposit extends SavingsAccount

instance Variables

  • public static final  double EARLY_WITHDRAW_PENALTY= 200 .


  • public boolean withdraw(double amount , boolean isEarly )  //@override the withdraw()  and applies penalty to balance

When you are done, you can begin the Bank project .

The Case for Abstract Classes and Methods




download-bttn Shape Class


  • public Shape( int _col)

instance Variables

  • protected int color

Accesor Methods

  • public abstract double getArea(); //returns the area of the triangle
  • public int getColor()
  • public void render()  { System.out.println(“rendering shape” ) ; }



Now, let’s refactor our class relationships to represent our new Iheritance Tree

  1. refactor all subclasses to reflect new class hierarchy
  2. Update our new InteractiveMath class –InteractiveMath3