|
HAHA!...
Wow I cant believe i did not see that. I always switch <, > around. I understand that it can not => or <= now and assume that is why i keept getting the error. Though I have been looking at switching compilers because I don't get an error code, like I do in my .Net . Because the error codes are easier to look up.
So I am able to get my statement working with for loop and now understand why it was not working in the first place. (because i am a dolt). I do think that something is off with my math so I will keep plugging away until I get it perfect. As I have said before, I don't like not understanding things.
Thanks,
Bactos
|
|
|
|
|
Ok so here is what I have now....
////Write the program in Java (without a graphical user interface)
//// using a loan amount of $200,000 with an interest rate of 5.75% and
//// a 30 year term. Display the mortgage payment amount and then list the
//// loan balance and interest paid for each payment over the term of the loan.
//// If the list would scroll off the screen, use loops to display a partial list,
//// hesitate, and then display more of the list.
//// */
////
import java.text.DecimalFormat;
public class CR1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DecimalFormat dollarAmount = new DecimalFormat("0.00");
double loan_amount = 200000.00; // amount of the loan
int terminyears = 30; // term of the loan in years
int number_of_payments = terminyears*12; // sets
double intrest_rate = 5.75; // intrest rate of the loan
double monthly_intrest_rate = intrest_rate/100/12; // calculates monthly inrest rate
double loanbalance = loan_amount - number_of_payments;
double monthly_payment = monthly_intrest_rate/(1 - Math.pow(1+monthly_intrest_rate,-number_of_payments)) * loan_amount;
double P = loan_amount;
double M = monthly_payment;
double J = monthly_intrest_rate;
int N = number_of_payments;
//double ipaid = monthly_payment * .0575;
int pCounter = 0; // sets counter to zero
for (int i =0; i < 359; i++)
{
double H = P * J;
double C = M - H;
double Q = P- C;
P=Q;
System.out.println("Payment Number:" +i);
System.out.println("Monthly Payment:$"+ dollarAmount.format (M));
System.out.println("Loan Balance: $" + dollarAmount.format (Q));
System.out.println("Intrest Paid:$ " + dollarAmount.format (H));
System.out.println();
pCounter += 0;
}//end for
if (pCounter ==9 )
{
try
{
Thread.sleep(20000000);
pCounter = 0;
}// end try
catch(InterruptedException e)
{
//
}// end catch
}// end if
if (loanbalance < 0)
{
System.out.println("Than you for using Billy's Program. Have a good DAY!!!");
System.exit(0);
}// end else
} // end main
}// end program
Everything works!!.. Thanks for your help.
Bactos
|
|
|
|
|
Bactos wrote: loanbalance = loanbalance - monthly_payment;
This is not what you want. You need something like
[code]
loanbalance = loanbalance - "principal" (which is part of your loan payment).
[/code]
So you need to figure out your loan payment (which is comprised of interest AND principal); You need to determine what part of that loan payment is pricipal and subtract it from the loan balance. This needs to be done in a loop for every month (30 years time 12 months = 360). I can guarantee you this will run off the screen page, so you need to handle that portion.
An amortized loan will have large interest and small principal in the early months. In the latter months, the opposite will be true; less interest and more principal as the parts of your loan payment. Just ask anyone who has a 30 year mortgage!
AF Pilot
|
|
|
|
|
I thought that it would be more complicated and so at the start of the assignment I had started doing it with amortized loan though it is supposed to me a simple interest. I think the point of the assignment is not the understanding of the morgage system as much as understanding loops and repeating.
I will mess around with it with the advice and post back in a little while.
~at work so I dont know what a little while will be.
Bactos
|
|
|
|
|
You were right...no matter how much I got the loops right and all if i did not have the loan amortized it would not work right.
Thanks
Bactos
|
|
|
|
|
i need some suggestions for converting a color image into a black and white image. Please help...
thanks in advance
|
|
|
|
|
Different colour crayon?
hmmm pie
|
|
|
|
|
|
|
How to read an incoming SMS using J2ME application running on a mobile phone? Please give full coding and helpful information.
|
|
|
|
|
NItharshan wrote: Please give full coding and helpful information.
No.
hmmm pie
|
|
|
|
|
Hi,
I succeeded using COM objects from my Java program using the Java Callable Wrappers (JCW)
I used Microsoft JVM and Microsoft JDK to implement JCW.
Will the same run on SUN Java VM as well under Microsoft Windows Platforms?
If not, then how can I use COM objects from java programs that runs on SUN Java VM under Microsoft Windows Platforms?
Thanks in advance
cheers
Varghese Paul
|
|
|
|
|
I need a little help getting this script to append a url after their affiliate id. I'm doing this all inside a form. A person puts in their affiliate id, clicks "get code" and its automatically put inside a url so they can copy and paste it on their own.
I have it all working but I need to add an additional url after their affiliate id is inserted...
What I'm getting on my results is:
http://refer.mysite.com/cgi-bin/clicks.cgi?CA=999999-0000&PA=666666
What I need is:
http://refer.mysite.com/cgi-bin/clicks.cgi?CA=999999-0000&PA=666666&HTML=http://www.mysite.com/promo/mypage.html
So here's the problem area of the code:
<a href="javascript:void(null)" onClick=" document.form2.linkg58url.value='http://refer.mysite.com/cgi-bin/clicks.cgi?CA=999999-0000&PA=' +document.getElementById('affiliateid').value">Get Code</a>
I can't figure out where to put the rest of my url:
&HTML=http://www.mysite.com/promo/mypage.html
Inside/Before/After here: .value
Or rather what to append after .value to add the rest of the needed url...?
Hope this makes sense. I'm sure it's something really dumb but for the life of this obvious newby I can't figure it out.
Thanks!
~~ SteelWidow ~~
|
|
|
|
|
So, I'd probably extract it to a function, but it'd look like this.
In your HTML:
<a href="javascript:void(null);"
onclick="doSomethingAmazing();">Get Code</a>
<script>
function doSomethingAmazing()
{
var val = 'http://refer.mysite.com/cgi-bin/clicks.cgi?CA=999999-0000&PA=';
val += document.getElementById('affiliateid').value;
val += '&HTML=http://www.mysite.com/promo/mypage.html';
document.form2.linkg58url.value = val;
}
</script>
<div class="ForumSig">"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty</div>
|
|
|
|
|
please help me with a java code to extract a pixel from a video stream and write data into it.Its a urgent request.
|
|
|
|
|
Jincy C J wrote: Its a urgent request.
Oh my god, is it?
|
|
|
|
|
hw to read pixels from a image
modified on Saturday, March 7, 2009 4:19 AM
|
|
|
|
|
Hello,
I would appreciate it if you help me in making a code for the UDP Ping by using Java.
|
|
|
|
|
|
Can someone please tell me where I can download Java Micro Edition? I need to deploy this run time environment on devices that cannot handle the full Java 6 run time environment due to Java 6 having a foot print that is way to large.
|
|
|
|
|
|
Unfortunately my company blocks that button from being used. They are horribly paranoid about things which makes research difficult. Can you please send me the site it sent you to when you clicked on that button?
|
|
|
|
|
|
Not Google but instead the use of the "I'm Feeling lucky" button. When clicked it takes me to a company made page which states "The Button you pressed has been known to be vulnerable to Internet Attacks.".
|
|
|
|
|
I went home to try using this tip above. It just takes me to the SUN website where it all information on Java ME but NO downloads available for JUST the run time environment. Sure I can get a full development platform to work off of but getting off of RAD 7.0 with my company just simply is not an option and that is why I need just the run time environment.
|
|
|
|