Java Genesis

Hints for Chapter 8: Inheritance

Problem 7: testing the class GoldCreditCard

Here is some code for a possible TestGoldCreditCard class.

        import genesis.*;

        public class TestGoldCreditCard {
	
            /*
            Test the class GoldCreditCard.
            */
	
            public static void main (String [] args) {
		CreditCard cc = new CreditCard("Bill", "34", 1000);
		cc.withdraw(600);
		cc.chargeInterest();
		SilverCreditCard scc =
                    new SilverCreditCard("Jo", "999", 2000);
		scc.withdraw(1600);
		scc.chargeInterest();
		GoldCreditCard gcc =
                    new GoldCreditCard("Tina", "43", 20000);
		gcc.withdraw(2600);
		gcc.chargeInterest();
		Transcript.println(cc);
		Transcript.println(scc);
		Transcript.println(gcc);
		gcc.chargeFee();
		GoldCreditCard.setInterestRate(5.25);
		GoldCreditCard.setFee(90);
		Transcript.println(cc);
		Transcript.println(scc);
		Transcript.println(gcc);
	}
}
Modify this as appropriate to test al the various features of the GoldCreditCard class.