Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I am a beginner attempting to create a small program in Java that allows a user to input their loan m.tuteehub.com/tag/term">term, interest rate etc. and will hopefully spit out an estimate for monthly repayments. When i am doing this, however, it gives me a completely different number to what i've calculated manually.
I been told to use the BigDecimal math system as the primitive double data type is not accurate enough for financial m.tuteehub.com/tag/calculations">calculations.
The steps i am doing are attempting to mimic this m.tuteehub.com/tag/formula">formula : M = P [i(1+i)^n/ 1-(1+i)^n]
BigDecimal iRateInput = BigDecimal.valueOf(iRate); BigDecimal twelve = new BigDecimal("12"); BigDecimal iRateMonthly = iRateInput.divide(twelve); BigDecimal one = new BigDecimal ("1"); BigDecimal iRateTemp = iRateMonthly.add(one); BigDecimal loanTermBD = BigDecimal.valueOf(loanTerm); loanTermBD = loanTermBD.multiply(twelve); BigDecimal iRatePower = iRateTemp.pow(loanTerm); BigDecimal iRateTop = iRateMonthly.multiply(iRatePower); BigDecimal iRateBottom = iRatePower.subtract(one); BigDecimal iRateTotal = iRateTop.divide(iRateBottom, BigDecimal.ROUND_UP); BigDecimal borrowAmountBD = BigDecimal.valueOf(borrowAmount); BigDecimal repayments = borrowAmountBD.multiply(iRateTotal);
I have been testing this code with:
P = 100,000
n = 15 years (*12)
r = 0.06p/a
According to my m.tuteehub.com/tag/calculations">calculations, the monthly repayment should be 843.86 but I am getting 6936.43
Help would be appreciated! <3
The first two types Java (double float) with a floating point number is stored as a binary representation of the exponent part. Some of the first race (unless string) have a fixed number of points. Unlike a number of floating point numbers of all times, an error reply small (about 10 ^ -19) Finally, why 0.009999999999999998 0.04-0.03 from the above example.
However BigDecimal provides us with the exact answer. so try with long and decimal first and check with small sample data first and identify the issue if its wrong.Hope this help u!
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.