ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 1 Day Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 04 May 2017 My Price 8.00

float TOTAL_LOANAMOUNT

 can someone add to this code so that it will output to a file? I am working with Xcode.

#include <iostream>
#include <iomanip>
using namespace std;
#include <cmath>

int main()
{
   // variables declared
   float TOTAL_LOANAMOUNT = 22500.00; //loan amount
   float INTEREST = 5.37; // interest rate
   int YEARS = 8; // loan period
   int TAX = 350;
   float monthInterest;
   float payment;
   int paymentsPeriod = YEARS * 12;
  
   cout<<"Month"<<"Interest rate"<<"EMI "<<"Tax "<<" Balance"<<endl;
   for(int i=0;i<paymentsPeriod;i++){
       monthInterest = (INTEREST / 100) / 12;
       payment = (TOTAL_LOANAMOUNT * pow(monthInterest + 1, paymentsPeriod) * monthInterest)/(-1 + pow(monthInterest + 1,paymentsPeriod) );
       if(i%12 == 0 && i>0){
           payment = payment + TAX;
       }
       payment = payment;
       cout<<(i+1)<<" $"<<monthInterest<<" $"<<payment<<" $"<<TAX<<" $"<<TOTAL_LOANAMOUNT<<endl;
       TOTAL_LOANAMOUNT = TOTAL_LOANAMOUNT- payment;
   }
   return 0;
}

 

Answers

(11)
Status NEW Posted 04 May 2017 02:05 AM My Price 8.00

-----------

Not Rated(0)