-5

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.

Chrisi Lerchen
  • 3
  • 1
  • 1
  • 5
  • 3
    Your question essentially is: `"here are some broad requirements and here is some code"` and that's about it. These sort of questions are **very** hard to answer well and usually get closed. Please try to ask a much more specific and answerable question and you'll likely get a decent and specific answer. Voting to close for now as too broad, but I'll be happy to retract the close vote should you ask a specific and answerable question. – Hovercraft Full Of Eels Apr 21 '16 at 03:26
  • This question isn't about programming. Its about credit cards. Voted to close as off topic. – ayushgp Apr 21 '16 at 03:27
  • @ayushgp, I'm not a fan of the question but it's certainly about programming both in the description and the *code*. – ChiefTwoPencils Apr 21 '16 at 03:31
  • OP wants us to brainstorm on the requirements of a credit card class. – ayushgp Apr 21 '16 at 03:33
  • 1
    @ayushgp, OK, so if you know there's requirements and classes how could you say it's not about programming? I'm just trying to point out that a bad question doesn't warrant an inaccurate close vote (or flag since you don't have the rep to close vote). – ChiefTwoPencils Apr 21 '16 at 03:35
  • I'm really asking to help with adding the methods asked for in the description. I have no idea how to do them, I started one but I don't know how to go from there. – Chrisi Lerchen Apr 21 '16 at 03:40
  • 3
    If you've got absolutely no idea whatsoever, then your problem is that you need to first learn Java basics, not dump the assignment here for others to do for you and explain for you. I'd start with the [Java Tutorials](http://docs.oracle.com/javase/tutorial/reallybigindex.html), and I'd also strongly urge you to speak with your instructor ASAP as you've got some catching up to do. – Hovercraft Full Of Eels Apr 21 '16 at 03:49
  • That's a great suggestion, your instructor won't know how much or what sort of help you need if you don't communicate your struggles. – br3nt Apr 21 '16 at 04:09

1 Answers1

2

The description you have given is basically check-list of functionality that needs to be implemented.

My suggestion is to break each task down into smaller and smaller bits and that you can work your way through and check of as you do them. This will give you a nice roadmap, and also give you good feels as you check of each task, which will provide you with much needed encouragement.

If a task is too much, try to break it down into smaller tasks that you can easily check off.

The description is pretty much already in the order that the code needs to be written in, so just work your way through the list.

If you run into a specific problem that you are struggling to solve, post a new question on Stack Overflow that follows the How to ask a good question guide

Here is the description broken up into separate reasonably manageable tasks:

  • Create a credit account class that has the following properties:
    • a description
    • principal balance,
    • an APR
    • a minimum monthly payment percentage (usually between 1% and 3%)
    • a minimum monthly payment amount
  • Has a constructor
    • Set each property to their initial values
  • Has getters and setters for each property
  • Has a toString method
  • Has a method to make a purchase
    • increases the principal by a certain amount
  • Has a method to make a payment
    • decrease the principle by a certain amount
  • Has a method to calculate the monthly interest amount
    • principal balance * APR/12
  • Has a method to 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).
  • Create an application that maintain a list of credit cards
    • create an array of credit card objects
  • for each card in the list
    • present the user with the principal, interest, and minimum payment amount for the month.
  • Add a method to the credit card class to calculate the number of months it would take to pay off the card
    • 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.
Community
  • 1
  • 1
br3nt
  • 9,017
  • 3
  • 42
  • 63