wood burning stoves*
The moose likes Beginning Java and the fly likes Java Course help needed -Mortgage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Course help needed -Mortgage " Watch "Java Course help needed -Mortgage " New topic
Author

Java Course help needed -Mortgage

Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
My instructor informed me that my java code was good, but the first 2 of 3 loans the numbers are not correct.
my loans do not have a zero balance after the last payment.

I also do not think the interest is being deducted correctly after each payment.

Also, somehow I was informed by the instructor to put this in an array

this is only my 4rth week of trying this course so any help with the code would be appreciated.

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

"mysong," welcome to JavaRanch! Please check your private messages by clicking on My Private Messages. Thanks!


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
ok sorry , I do believe it should be corrected now for my name
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by mysong:
My instructor informed me that my java code was good, but the first 2 of 3 loans the numbers are not correct. my loans do not have a zero balance after the last payment...

Looking at the 7-year case, I see this ends up with a balance of -$0.08 instead of zero. This is just the result of rounding.

The total you're using with interest is $274,900.00. This amount divided by 84 months results in a rounded monthly payment of $3,272.62. But because this is rounded (a fraction of a cent high), it's not going to work out exactly right at the end. Indeed, $3,272.62 multiplied by 84 is $274,900.08, which is why the ending balance is off.

There are different ways to handle this. I don't know what your instructor is looking for, but my suggestion would be to adjust the final payment by whatever rounding discrepancy there is.
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
should I not use the decimal format in the calculations?
only use it for the printout that will be the final item seen to the user?

If so Can you help guide me on this process?
[ June 01, 2008: Message edited by: Mike Songstin ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Mike Songstin:
should I not use the decimal format in the calculations?
only use it for the printout that will be the final item seen to the user? ...

That might seem logical, but consider that the decimal format is used to determine the exact amount the customer is actually paying each month (since they can't split cents). So I don't think the auditors would go for that, because you would be applying a payment amount different than what the customer actually remitted. Specifically, the customer would be sending you $3,272.62, but you would only be giving them credit for $3,272.6190476190477 (give or take). This might seem trivial, but depending on how your financial service is regulated...

So I would find the difference caused by the rounding error, then adjust the final payment by that amount. Start with just finding that difference, and add a println to display it (so you can validate your calculation). Once you have that, add some code checking each payment to see if it's the last, and if so, apply the adjustment.
[ June 01, 2008: Message edited by: marc weber ]
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
Please note that I am not a math person.....Java is only 4 weeks old to my brain. and I have gotten this far.
I just need to pass this course and there is only one more assignment due for me to pass this.

CourseText books and class materials does not cover doing math and mortgages.
It explains how to have "HELLO WORLD" appear with java.

I am begging for coding help.
Jorge Bendahan
Ranch Hand

Joined: Apr 11, 2008
Posts: 82
double amount,moPay,totalInt,principal = 200000;
I suspect that the compiler "thinks" you�re working with Integers because the value you`re passing actually appear more suitable to integers at first, try checking the datatypes behaviour in a debbuger or isolate the operations and check the output by sending it to the system console. try sending the result of this to sys.out.
amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
edit this area where the "amount " line is .....near the bottom of the code???

Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
We are not using anything but JAVAC to compile it...
Trust me ...each class that we take is only 5 weeks long....one night a week...so 5 total classes and that is all....so all in all there are 4 weeks to provide the week 5 final product.

It is tough working,...college and family and kids ...to figure this all out in 4 weeks.
so any help would be great from you professionals.

I am not going into programming...I am going for networking....and I am made to take java.

Heck....I been online all weekend researching,.....and missed out on many family weekend items.

This course is fustrating me.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Mike Songstin:
Please note that I am not a math person...

There's no heavy math lifting here.

As noted above, $3,272.62 multiplied by 84 is $274,900.08. And $274,900.00 - $274,900.08 = -$0.08.

You already have variables representing the values you need. Start by writing code that will perform this calculation, and display the result with a println so you can validate it.

Then you just need to add some code that checks each payment to see if it's the last (if pmt == totalMo), and add the adjustment to the last payment amount.

Give it a try!
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
I am lost.
sorry

brain is dumping

i see what you mean ...but I am confused on do I edit only one line of code ..or many
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Mike Songstin:
edit this area where the "amount " line is .....near the bottom of the code? ...

I see what you're thinking, and that should accomplish the goal of ending with a zero balance. But the problem is it won't match what the customer actually sent in, so I'm not sure that would be an acceptable way of handling it.

Remember, the rounded monthly payment is the exact amount the customer is sending in, and the rounding is necessary because the customer can't remit fractions of a cent. The problem is that a rounded monthly payment will not always result in a zero balance at the end. So I really think you need an adjustment on the final payment.
[ June 01, 2008: Message edited by: marc weber ]
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
How do I accomplish that.

The instructor did tell me last week that maybe I should only do the decimal format at final output ( for what is viewed to the user)

if so ...what lines should I edit to take out the decimal formatting so that it will all still calculate......until the final "shown output"
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Mike Songstin:
...i see what you mean ...but I am confused on do I edit only one line of code ..or many

I'm thinking of a single line to calculate the adjustment amount (as laid out above).

Then modify the following code so that if(pmt == totalMo), the payment is (amount + adjustment) instead of just "amount."

You've already accomplished a lot in putting the original code together. I know you can do this (if you give your mind a short break and come back to it).
[ June 01, 2008: Message edited by: marc weber ]
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
replace that with what area of my original code.
I am affraid I will take out items in my code that I will still need

please show my original code to replace with what you are suggesting

I do not want to cause more errors ..and more headaches
[ June 01, 2008: Message edited by: Mike Songstin ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

You can do this by adding a "special case" for handling the last payment. Basically, what you have now is...

For the special case, you might use something like...

Let's see what you come up with by filling in these blanks.
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
Honestly...you are speaking to a person of 4 weeks of java.....
I am not learning this at all from college or my books....and I do not know where to fill in the blanks.

I am sorry to waste your time.
I give up
I do not know this lingo

I am going to college for hooking one pc to networks etc.
not this java programing

Please show me the way...

from my research this same college crap has been in place before 2003...and everyone states that it is a waste of time to learn JAVA in this format....I tend to agree

I have honestly been trying all weekend....look at the time of my first post in here
[ June 01, 2008: Message edited by: Mike Songstin ]
Mike Songstin
Greenhorn

Joined: Jun 01, 2008
Posts: 11
ok I fixed my 15 year loan portion

how would I display the values to the user in an array???

for all three each loans


[ June 03, 2008: Message edited by: Mike Songstin ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Course help needed -Mortgage