I am having a nightmare time with an assessment task. I am only a newie at Java and I am not sure what I am doing.
In the program I need to create a investment calculator that will enable the user to input a payement amount, how many payments and the interest rate. They then with have the choice of a single payement or annual payments. The results fo the payments are then passed onto a barchart and also printed in a terminal window.
I have created the method for caluclating the single payment option but can not for the life of me work out the annual payments. i know that i need to use an array and a loop but I am not sure how to construct it. Can you help me at all????
here is my coding so far for for the single payment and the structure for the annual payments:
import com.grapher.Valuable;
public class Payment implements Valuable
{
private double paymentAmount;
private int paymentTime;
public Payment(double aPaymentAmount, int aPaymentTime)
{
paymentAmount = aPaymentAmount;
paymentTime = aPaymentTime;
}
public double getValue (int valuationTime, double valuationRate)
{
return paymentAmount*Math.pow((1+(valuationRate/100)),valuationTime);
}
}
publicClass PaymentSeries implemets Valuable
{
ArrayList Payments;
public PaymentSeries()
{
double paymentAmount;
int paymentTime;
}
public void addPayment(Payment P)
{
}