MPayment[p_,k_,apr_]:=Module[{r,n,m},$RecursionLimit=k+1;r=(1+apr)^(1/12)-1;m=m/.Solve[p(1+r)^k-m((1+r)^k-1)/r==0,m][[1]];Print["Loan amount = $",p,"\tAnnual interest rate = ",100apr,"%\tDuration of loan = ", k," months"];Print["Monthly payment = $",m];Print[ListPlot[Table[{n,p(1+r)^n-m((1+r)^n-1)/r},{n,0,k,1}],ImageSize->900,Joined->True,GridLines->{Table[12l,{l,1,Floor[k/12]}],Automatic},AxesLabel->{"months","amount owed"},BaseStyle->{14,Bold},Ticks->{Table[12l,{l,1,Floor[k/12]}],Automatic}]];Print["Total payment = $",k m]]

MPayment[200000,360,.05]