/* CSC 16 Assignment 2, Part I Due Tuesday 9/20 In this assignment, we practice the basics of object oriented programming. 1. Complete the date class from last week by adding the method public boolean before(date D) which we sketched out in class. The function is called as in A.before(B), where A and B are both date objects. It should return true iff the date represented by A comes before the date represented by B. 1b. Put the date class in a sperate file called "date.java", and mark the date class as "public". This will allow any java program in the same directory to use the date class. The date class is currently inside calendar.java (on web page). 2. Write a program called lab3.java which implements the following class. The class represents metrocards. Each metrocard has a dollar value, an expiration date. All metrocards have the same rate ($2 per ride), which is why the rate variable is static. ** Complete the implementation of the methods as described. ** 3. Write a main method that creates several metrocard objects and insert them into a array. Write a loop that prints out the value and expiration date of every card in the array. */ class metrocard { private double value; private static double rate = 2; private date expiration; // contructor: initialize value and expiration date public metrocard(double v, date e) { value = v; expiration = e; } public metrocard(double v, int m, int d, int y) { value = v; expiration =new date(m,d,y); } // set a new rate value (why is this static?) public static void changerate(double newrate) { rate = newrate; } // subtract 2 from the value, if value >= 2 AND the // the card has not expired. public void useonce(date currentdate) // returns the current value public double value() { return value; } // Add amt to the value, and be sure to give one free ride // for every 10 dollars added public void refill(double amt) // Transfer the value of an old metrocard to the new card. // That is, it will be called as in newcard.transfer(oldcard). public void transfer(metrocard oldcard) { } } // metrocard /* in main... metrocard mycard= new metrocard(20, new date(9,13,2005)); metrocard myothercard = new metrocard(20,9,13,2005); metrocard yourcard new metrocard(10,...) mycard.refill(10); mycard.transfer(yourcard); */