A credit account has a description, principal balance, an APR, a minimum monthly payment percentage (usually between 1% and 3%) and a minimum monthly payment amount.In addition to the constructor, setters, getters, and toString methods, add methods to make a purchase using the credit card (increasing the principal by a certain amount), make a payment on the card (decrease the principle by a certain amount), calculate the monthly interest amount (principal balance * APR/12), and calculate the minimum monthly payment (principal balance * minimum monthly payment rate or the minimum monthly payment amount, whichever is greater, or the principle balance if it is lower than the calculated minimum payment amount). Hint: If storing the rates as percentages, remember to divide by 100 to get the decimal value (ex. 2% means to multiply by .02).
Since most people have multiple credit cards, use this class to write an application to maintain a list of credit cards (create an array of credit card objects), and present the user with the principal, interest, and minimum payment amount for the month for each card in the list.
Add a method to the credit card class to calculate the number of months it would take to pay off the card (get to a balance of zero) if only the minimum monthly payment was paid each month. Remember that this method should not change the current information for the card in any way, it is just a calculation.
This is what I have so far:
public class CreditCardDebt {
//Instance Variables
private String cardName;
private double princBal;
private double aPR;
private double monthPayPercent;
private double monthPayAmount;
//Constructor
public CreditCardDebt(String name, double origBal, double apr, double mnthPercent, double mnthAmount) {
cardName = name;
princBal = origBal;
aPR = apr;
monthPayPercent = mnthPercent;
monthPayAmount = mnthAmount;
}
//Mutator/Setter
public void cardName(String name){
cardName = name;
}
public void princBal(double origBal){
princBal = origBal;
}
public void aPR(double apr){
aPR = apr;
}
public void monthPayPercent(double mnthPercent){
monthPayPercent = mnthPercent;
}
public void monthPayAmount(double mnthAmount){
monthPayAmount = mnthAmount;
}
//Accessor/Getter
public String getCardName () {
return cardName;
}
public double getPrincBal () {
return princBal;
}
public double getAPR () {
return aPR;
}
public double getMonthPayPercent () {
return monthPayPercent;
}
public double getMonthPayAmount () {
return monthPayAmount;
}
//Other Methods
public double addPurchase () {
return princBal+;
}
public double makePay () {
return -princBal;
}
public double calcMonthInterestAmnt () {
return princBal*(aPR/12);
}
public doublt calcMinMonthPay () {
return princBal *
//toString
public String toString () {
return "Card: " + cardName + " has a principle balance of: "
+ princBal + ", an APR of " + aPR +
", a minimum monthly payment percentage of " + monthPayPercent +
", and a minimum monthly payment amount of " + monthPayAmount + ".";
}
}
I know I'm missing a lot.. Please help.