Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

Members have full access to the forums. Advertisements are removed for registered users.

Thread: NEED HELP GETTING MY ANNUITY PRORAM TO WORK!!! Quartley payment is \$500 profit is... 6,255.12

1. NEED HELP GETTING MY ANNUITY PRORAM TO WORK!!! Quartley payment is \$500 profit is... 6,255.12

HERE IS MY CODE

double p; //amount of payment
double r;//APR is between 1.000% 10.000%
double apr;
double y;
double n; //number of periods
double v; //annuity value
double profit;

//Get quarterly payment
System.out.println("\t\t\tEnter Quarterly Payment Amount:");
Scanner keyboard = new Scanner(System.in);
p = keyboard.nextFloat();

//Get APR
System.out.println("Enter APR:");
apr = keyboard.nextFloat();
r = (apr * .01); //Multiply by hundreths

//Get Contract Length
System.out.println("Enter Contract length.");
y = keyboard.nextFloat();
n = y * 4;

//ECHO
System.out.println("Quarterly Payment:" + p);
System.out.println("APR:" + r);
System.out.println("Contract Length: " + y);

v = p * (Math.pow ( 1 + r , n ) - 1 ) / r ;

System.out.println("Annuity Value:

annuity should be 26,255.12 with an investment of \$20,000 profit is \$6,255

2. Re: NEED HELP GETTING MY ANNUITY PRORAM TO WORK!!! Quartley payment is \$500 profit is... 6,255.12

Originally Posted by bush.bryant
annuity should be 26,255.12 with an investment of \$20,000 profit is \$6,255
1. What is your question (What is it doing, not doing, provide your test data to get the above).
2. Paste your code in formatting tags
3. Make sure your program compiles
4. When taking user input, you don't need to use println. print by itself will suffice and allow you to take the input from the same line.
5. Why all the hardcoded tabs in the first print statement?