// Arup Guha
// 1/16/2010
// Inherits from Credit Card and has some extra features not 
// present with all credit cards.

public class GoldCreditCard extends CreditCard  {
	
	private int freqFlyerMiles;
	
	// Sets up a GoldCard with a different credit limit and interest rate.
	public GoldCreditCard(String first, String last, int year) {
		super(first,last,year);
		creditLimit = 7500;
		interestRate = 12;
		freqFlyerMiles = 0;
	}
		
	// Does a regular charge, but ALSO adds frequent flyer miles.
	public boolean charge(double amount) {
		
		// The super class handles this. If it works we'll get some miles.
		if (super.charge(amount)) {
			freqFlyerMiles += 2*((int)amount);
			return true;
		}
		
		// Nothing happened.
		return false;
	}
	
	// Gets more miles and a higher limit than a regular card.
	public void advanceYear() {
		super.advanceYear();
		creditLimit += 1000; // Since a regular Credit Card
							 // already gets an extra 1000 added.
		freqFlyerMiles += 10000;	
	}
	
	// Returns a string representation of a Gold Credit Card.
	public String toString() {
		return super.toString() + "\n"+"Freq Flyer Miles: "+freqFlyerMiles;
	}
	
}