|
-
November 26th, 2014, 02:43 PM
#1
Writing Java from pseudocode: interest payments
calculate how long it would take to pay off a loan of 500 pounds if there was 10% interest monthly, and 100 pounds was paid each month. This code is in a pseudocode, but I can't figure out how to write it in Java, I'm really new to Java and need some assistance, I appreciate any help that is give, thanks!
Code:
set months = 1
set balance = 500
set totalpaid = 0;
while balance > 100
balance = balance - 100;
set interest = balance * 0.1
balance = balance + interest
totalpaid = totalpaid + 100
months = months + 1
endwhile
totalpaid = totalpaid+balance
display "You paid "+totalpaid
display "It took you "+months+" months"
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|