Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C++, Using a while loop to create a list of monthly payments. Create a form w

ID: 3683839 • Letter: I

Question

In C++, Using a while loop to create a list of monthly payments. Create a form with textboxes to enter loan amount, term of the loan in year, starting annual rate, ending annual rate and rate step value, then use the Visual Basic’s Pmt function to compute the payment for each rate and display the monthly payments in a listbox. Requirement; Use the validating event of the ending rate’s textbox to enforce the rule that the ending rate must be greater than the starting rate. How would I include the while loop and the Pmt function in the code??

Explanation / Answer


#include<list>
using Microsoft.VisualBasic;

in main program:

int sr;//starting rate
int er;//ending rate
int i=sr,j=0;//iterators
int paymentsnumber=er-sr;

list<int> payments;

//while loop:

//from starting rate to ending rate
while(i<er)
{
   //calculate payment using pmt function
   payment = Financial.Pmt((i/100)/12,paymentsnumber,loan,0,term)*-1);
   //insert payments into list
   payments.insert(j,payment);
   i++;
   j++;
}