I'm a noob at C++ and this is the first assignment in my class. I'm not sure If I did it right. Can someone please check and correct it please? Thank you

Question:
develop the pseudo code for the following:
Negotiating a consumer loan is not always straight forward. One form of loan is the discount installment loan, which works as follows. Suppose a loan has a face value of $1000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value of $1000 by 0.15 yielding $150.0. That figure is then multiplied by the loan period of 1.5 years to yield $225 as the total interest owed, that amount is immediately deducted from the face value, leaving the consumer with only $775.00. Repayment is made in equal monthly installments based upon the face value. So the monthly payment will be $1000 divided by 18, which is $55.56. This method of calculation may not be too bad if the consumer needs $775 dollars, but the calculation is a bit more complicated if the consumer needs $1000. Write the pseudo code which would take 3 inputs, the amount the consumer needs to receive, the interest rate and the duration of the loan in months. The pseudo code should also make sure to calculate the face value required in order for the consumer to receive the amount needed and calculate the monthly payment.

My Answer:
Set the value of loan to $1000
Set the value of interest rate to .15
WHILE Set the value of months to 18 DO
Set the value of years to (months / 12 = 1.5)
WHILE (face value * interest rate = $150) DO
Set the value of total interest owed to ($150 * years = $225)
Set the value of remaining loan value to (loan – total interest = $775)
Set monthly payment to (loan / months = $55.56)

Print out the values of loan and monthly payment.

Suppose a loan has a face value of $1000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value of $1000 by 0.15 yielding $150.0. That figure is then multiplied by the loan period of 1.5 years to yield $225 as the total interest owed, that amount is immediately deducted from the face value, leaving the consumer with only $775.00.

Therefore the simplified formula is as following:

Received Value = Face Value * (1 - Interest Rate * Duration)
775            = 1000       * (1 - 0.15          * 1.5     )

but the calculation is a bit more complicated if the consumer needs $1000.

No true. It is not complicated. The formula is as following

                    Received Value
Face Value = --------------------------------
               1 - Interest Rate * Duration

              1000.000
1290.3225 =  ---------------
              1 - 0.15 * 1.5

If customer want to receive $1000 with 1.5 years duration and 15% interest, he/she need 1290.3225 face value.

Edited 10 Months Ago by invisal

This article has been dead for over six months. Start a new discussion instead.