Help Required! Unsure of how to reach required output!

So, I've got a question, and more so than needing help to program it I think I may actually simply lack the mathematical understanding to be in a programming class, which is beginning to worry me! I could seriously use some help on figuring out the formula or being guided to a certain area of study that could allow me to understand a way to get this value. To the question....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Negotiating a consumer loan is not always straightforward. One form of the loan is the discount installment loan, which works as follows.

Suppose a loan has a face value $1,000.00, the interest rate is 15%, and the duration is 18 months. The interest rate is computed by multiplying the face value of $1,000.00 by 0.15 to yield $150.00. This figure is then multiplied by the loan period of 1.5 years to yield $225.00 as the total interest owned. The amount is immediately deducted from the face value, leaving the consumer with only $775.00.

Repayment is made in equal monthly installment based on the face value. Hence, the monthly loan payment will be $1,000.00 divide by 18, which is $55.56. This method of calculation may not be too bad if the consumer needs $775.00 dollars, but the calculation is a bit more complicated if the customer needs $1000.00.

Write a program that will take three inputs:
- the amount the consumer needs to receive
- the interest rate
- the duration of the loan in months
The program should then calculate the face value required in order for the consumer to receive the amount needed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I've been working at it for a good two hours and simply can't figure out how to get the needed amount of $ payment for a certain desired loan amount... Ack!

Here's my code, thanks to anyone who can help me in any way!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
using namespace std;

int main()
{
    char Answer;
    char End;

    do
    {
             cout.setf(ios::fixed);
             cout.setf(ios::showpoint);
             cout.precision(2);
             
           double Face_Value(0);
           double Interest_Rate(0);
           double Loan_Duration(0);
           
                  cout << "Hello! This service has been provided as courtesy from your current bank.\n"
                       << "This allows one to discover the amount available for a claim on a loan,\n"
                       << "with three variables provided. To commence the process, please input\n"
                       << "The requested values and hit \"Enter\" after each input request.\n"
                       << "Input the duration to repay the loan in months.\n"
                       << "Be sure to input the correct decimal percentage.\n\n";
                  cout << "Desired Loan Amount: $";
                  cin >> Face_Value;

                  cout << "Given Interest Rate: ";
                  
             cout.setf(ios::fixed);
             cout.setf(ios::showpoint);
             cout.precision(3);
             
                  cin >> Interest_Rate;

                  cout << "Duration to Repay Loan: ";
                  cin >> Loan_Duration;
                  
             cout.setf(ios::fixed);
             cout.setf(ios::showpoint);
             cout.precision(2);
             
           double Loan_Duration_Yearly = (Loan_Duration/12);
           double Loan_Interest =((Face_Value * Interest_Rate) * Loan_Duration_Yearly);
           double Monthly_Repayment = (Face_Value/Loan_Duration);
           double Loan_Given = (Face_Value - Loan_Interest);
                  
                  cout << "The total loan interest is: $" << Loan_Interest << ".\n"
                       << "The given amount is: $" << Loan_Given << ".\n"
                       << "The monthly payment for " << Loan_Duration << " months is: $" << Monthly_Repayment << ".\n" 
                       << "If you would like to repeat this procedure, please insert Y and hit enter.\n"
                       << "If not, hit N and enter.\n";
                      
           cin >> Answer;
                  
                  
           
           
    } while (Answer == 'y' || Answer == 'Y');
    
    cout << "Goodbye! Hit any key and enter to close the program!";
    cin >> End;
    cout << "Kaboom!";
    
    return 0;
}
Last edited on
As both a gift and a curse, it's annoying to work with formulas in most programming languages. In your case you're lucky as it exactly states word for word how your algorithm should work, you don't need any formula at all.
Perhaps I'm just blind, or incompetent then, for I can't for the life of me figure out how to calculate the amount that should be received, and from that the loan amount that will be required (After deducting interest and having that amount be there) Any hints as to what I could do?
Are you inputting .15 for the interest rate or 15 for the 15%? because it should be .15 since 15/100 = .15
It looks correct to me.
Hello! This service has been provided as courtesy from your current bank.
This allows one to discover the amount available for a claim on a loan,
with three variables provided. To commence the process, please input
The requested values and hit "Enter" after each input request.
Input the duration to repay the loan in months.
Be sure to input the correct decimal percentage.

Desired Loan Amount: $1000
Given Interest Rate: .15
Duration to Repay Loan: 18
The total loan interest is: $225.00.
The given amount is: $775.00.
The monthly payment for 18.00 months is: $55.56.
If you would like to repeat this procedure, please insert Y and hit enter.
If not, hit N and enter.
Topic archived. No new replies allowed.