助学贷款 利息计算 利率计算
【情况】2006/09 入学,贷款 20000(2万人民币)。2010/06毕业。毕业后读研2年,2012/06读研毕业。
【假如】
本科期间无需利息。读研期间算展期,年利率 5.94% 。毕业后算逾期,年利率 10.26%。
假如在2013/10还清贷款。分期每月付款如下。
$data = array(20120621 => 360.33,20120811 => 341.46,20120911 => 341.46,20121011 => 341.46,20121111 => 341.46,20121211 => 341.46,20130111 => 342.22,20130211 => 337.04,20130311 => 337.04,20130411 => 337.04,20130511 => 337.04,20130611 => 337.04,20130711 => 337.04,20130811 => 337.04,20130911 => 337.04,20131008 => 334.99,20131009 => 2224.79,20131011 => 337.04,20131014 => 16223.38,);
【那么】
1)按照这个数据他实际应该付利息是多少?
2)假如他读研中途退学,那么利息该多少?
【参考】
以下是我自己写的一个PHP代码计算,看是否有误
';while($ttLeft > 0){ $money = $moneyArr[$i]; $month = $monthArr[$i]; $ttBack += $money; //累计还款总额 $rate = getRate($month); $xi = $ttLeft*$rate/12; $ttXi += $xi; //$ttLeft += $xi;//假设不需要复利 $ttLeft -= $money; //减去已还款 echo ''; $i++; if($i > 100) { echo ' $i break; '.($i+1).' 时间:'.$month.',本月实际还款:'.number_format( $money ).' 算出本月利率:'.($rate*100).'%,算出本月利息:'.number_format($xi).',剩余:'.number_format( $ttLeft ).'
'; break; }}echo '
总贷款:'.number_format( $moneyDK ).',总还款:'.number_format( $ttBack );echo '。此程序计算出总额外利息:'.number_format( $ttXi);
输出结果:
1 时间:20120621,本月实际还款:360 算出本月利率:10.26%、利息:171、剩余:19,6402 时间:20120811,本月实际还款:341 算出本月利率:10.26%、利息:168、剩余:19,2983 时间:20120911,本月实际还款:341 算出本月利率:10.26%、利息:165、剩余:18,9574 时间:20121011,本月实际还款:341 算出本月利率:10.26%、利息:162、剩余:18,6155 时间:20121111,本月实际还款:341 算出本月利率:10.26%、利息:159、剩余:18,2746 时间:20121211,本月实际还款:341 算出本月利率:10.26%、利息:156、剩余:17,9327 时间:20130111,本月实际还款:342 算出本月利率:10.26%、利息:153、剩余:17,5908 时间:20130211,本月实际还款:337 算出本月利率:10.26%、利息:150、剩余:17,2539 时间:20130311,本月实际还款:337 算出本月利率:10.26%、利息:148、剩余:16,91610 时间:20130411,本月实际还款:337 算出本月利率:10.26%、利息:145、剩余:16,57911 时间:20130511,本月实际还款:337 算出本月利率:10.26%、利息:142、剩余:16,24212 时间:20130611,本月实际还款:337 算出本月利率:10.26%、利息:139、剩余:15,90513 时间:20130711,本月实际还款:337 算出本月利率:10.26%、利息:136、剩余:15,56814 时间:20130811,本月实际还款:337 算出本月利率:10.26%、利息:133、剩余:15,23115 时间:20130911,本月实际还款:337 算出本月利率:10.26%、利息:130、剩余:14,89416 时间:20131008,本月实际还款:335 算出本月利率:10.26%、利息:127、剩余:14,55917 时间:20131009,本月实际还款:2,225 算出本月利率:10.26%、利息:124、剩余:12,33418 时间:20131011,本月实际还款:337 算出本月利率:10.26%、利息:105、剩余:11,99719 时间:20131014,本月实际还款:16,223 算出本月利率:10.26%、利息:103、剩余:-4,226总贷款:20,000,总还款:24,226。此程序计算出总额外利息:2,717
回复讨论(解决方案)
对不对应该问出题的人,莫非你就是出题的人考我们?
php输出答案对就对,只有程序写得好不好的问题
对不对应该问出题的人,莫非你就是出题的人考我们?
php输出答案对就对,只有程序写得好不好的问题
答案跟这个不一致。不知道银行到底怎么算的,利率是浮动的。
利率当然是浮动的

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
