Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
validate($data)) { $this->loan_amount = (float) $data['loan_amount']; $this->term_years = (int) $data['term_years']; $this->interest = (float) $data['interest']; $this->terms = (int) $data['terms']; $this->terms = ($this->terms == 0) ? 1 : $this->terms; $this->period = $this->terms * $this->term_years; $this->interest = ($this->interest/100) / $this->terms; $results = array( 'inputs' => $data, 'summary' => $this->getSummary(), 'schedule' => $this->getSchedule($data), ); $this->getResults($results); } } private function validate($data) { $data_format = array( 'loan_amount' => 0, 'term_years' => 0, 'interest' => 0, 'terms' => 0 ); $validate_data = array_diff_key($data_format,$data); if(empty($validate_data)) { return true; }else{ echo "
"; echo '

Missing Values

'; foreach ($validate_data as $key => $value) { echo ":: Value $key is missing.
"; } echo "
"; return false; } } private function calculate() { $power = pow((1 + $this->interest),$this->period); if($power > 0){ $d= 1/$power; $interest=0; $deno = 1 - $d; if($deno > 0){ $this->term_pay = ($this->loan_amount * $this->interest) / $deno; $interest = $this->loan_amount * $this->interest; $this->principal = $this->term_pay - $interest; $this->balance = $this->loan_amount - $this->principal; return array( 'payment' => $this->term_pay, 'interest' => $interest, 'principal' => $this->principal, 'balance' => $this->balance ); }else{ return array( 'payment' => $this->term_pay, 'interest' => $interest, 'principal' => $this->principal, 'balance' => $this->balance ); } }else{ return array(); } } public function getSummary() { $this->calculate(); $total_pay = $this->term_pay * $this->period; $total_interest = $total_pay - $this->loan_amount; return array ( 'total_pay' => $total_pay, 'total_interest' => $total_interest, ); } public function getSchedule($data) { $schedule = array(); $limit = $data['terms']*$data['term_years']; $i=0; while ($i < $limit) { $i++; array_push($schedule, $this->calculate()); $this->loan_amount = $this->balance; $this->period--; } return $schedule; } private function getJSON($data) { header('Content-Type: application/json'); $this->results = $data; return $this->results; } private function getResults($data) { //header('Content-Type: application/json'); $this->results = $data; return $this->results; } } ?>