Negotiating a consumer loan is not always straightforward. One form of loan
is the discount installment loan, which works as follows. Suppose a loan has a face
value of $1,000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value of $1,000 by 0.15 to yield $150. 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
$775. Repayment is made in equal monthly installments based on the face value. So the
monthly loan payment will be $1,000 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 $1,000. Write a program that will take three
inputs: the amount the consumer needs to receive, the interest rate, and 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. It should also calculate the monthly
payment. Your program should allow the calculations to be repeated as often as the user
wishes.


I dont know how to calculate the face value!!

I did this but there's an obvious error on the algorithm

#include <iostream>
using namespace std;
int main()

{

	double money_needed, face_value, interest_rate, number_of_months, monthly_payment, time, interest;
	int const year = 12, percent_decimal = 100;
	char ans;
	
	do
	{

		cout << "Enter the amount of money you need from a loan.\n";
		cin >> money_needed;
		cout << "Enter the interest rate of the loan in percentage.\n";
		cin >> interest_rate;
		cout << "Now enter the duration of the loan in months.\n";
		cin >> number_of_months;

		interest = interest_rate / percent_decimal;
		time = number_of_months / year;
		face_value = (1 + money_needed) / (interest_rate * time);
		monthly_payment = face_value / number_of_months;

		cout.setf(ios::fixed);
		cout.setf(ios::showpoint);
		cout.precision(2);

		cout << "Your face value is " << face_value << ".\n";
		cout << "That means that your monthly payment would be " << monthly_payment << ".\n";

		cout << "Do you want to do it again?\n";
		cout << "Press y for yes, press n for no: ";
		cin >> ans;
	} while (ans == 'y' || ans == 'Y'); 

	cout << "Goodbye!\n";

	return 0;
}

Anyone can help me?

I guess face value is money neeeded.

Negotiating a consumer loan is not always straightforward. One form of loan
is the discount installment loan, which works as follows. Suppose a loan has a face
value of $1,000, the interest rate is 15%, and the duration is 18 months. The interest is computed by multiplying the face value of $1,000 by 0.15 to yield $150. 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
$775. Repayment is made in equal monthly installments based on the face value. So the
monthly loan payment will be $1,000 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 $1,000. Write a program that will take three
inputs: the amount the consumer needs to receive, the interest rate, and 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. It should also calculate the monthly
payment. Your program should allow the calculations to be repeated as often as the user
wishes.


I dont know how to calculate the face value!!

I did this but there's an obvious error on the algorithm

#include <iostream>
using namespace std;
int main()

{

	double money_needed, face_value, interest_rate, number_of_months, monthly_payment, time, interest;
	int const year = 12, percent_decimal = 100;
	char ans;
	
	do
	{

		cout << "Enter the amount of money you need from a loan.\n";
		cin >> money_needed;
		cout << "Enter the interest rate of the loan in percentage.\n";
		cin >> interest_rate;
		cout << "Now enter the duration of the loan in months.\n";
		cin >> number_of_months;

		interest = interest_rate / percent_decimal;
		time = number_of_months / year;
		face_value = (1 + money_needed) / (interest_rate * time);
		monthly_payment = face_value / number_of_months;

		cout.setf(ios::fixed);
		cout.setf(ios::showpoint);
		cout.precision(2);

		cout << "Your face value is " << face_value << ".\n";
		cout << "That means that your monthly payment would be " << monthly_payment << ".\n";

		cout << "Do you want to do it again?\n";
		cout << "Press y for yes, press n for no: ";
		cin >> ans;
	} while (ans == 'y' || ans == 'Y'); 

	cout << "Goodbye!\n";

	return 0;
}

Anyone can help me?

These are the goofiest loan terms I've ever heard of. Any bank offering loan terms like this should be immediately closed down for loansharking. Even the loansharks only require you to pay full interest on the initial amount BORROWED for every payment, not the eventual total amount PAID, which is apparently what the "face value" is. I understand the need to simplify loan formulas to make the programming assignment easier, but in my opinion whoever gave this assignment is doing a real disservice by creating terms that will have to be completely unlearned later when doing any kind of real loan calculations. Interest in the real world is based on the principal still owed, not the sum of all the eventual payments.

Above comments aside, you have a definite problem with this formula:

face_value = (1 + money_needed) / (interest_rate * time);

You are mixing dollars and percentages with this term, which leads to trouble:

1 + money_needed

Before trying to code this, you need to figure out mathematically what you need to do. Figure out the math formulas first, THEN code them. You need to figure out the ratio of face value to money needed. This is going to be based on the annual interest rate and the loan duration. Don't go online to try to find real loan formulas because they almost certainly aren't going to work for this loan, given its terms. Go through the numbers in the example given and try to figure out the formula, then generalize the formula to allow for other numbers.

Try this:

#include <iostream>
using namespace std;
int main()

{

	double face_value, new_face_value, interest_rate, total_interest, number_of_months, monthly_payment, time, interest;
	int const year = 12, percent_decimal = 100;
	char ans;
	
	do
	{
	  cout << "Enter the amount of money you need from a loan.\n";
	  cin >> face_value;
	  cout << "Enter the interest rate of the loan in percentage.\n";
	  cin >> interest_rate;
	  cout << "Now enter the duration of the loan in months.\n";
	  cin >> number_of_months;

	  interest = (face_value*interest_rate) / percent_decimal;
	  time = number_of_months / year;
	  total_interest = (face_value*time*interest);
	  new_face_value = (face_value+total_interest); 
  	  monthly_payment = (new_face_value/number_of_months);

  	  cout.setf(ios::fixed);
	  cout.setf(ios::showpoint);
	  cout.precision(2);

	  cout << "The amount of money you need to borrow is " << new_face_value << ".\n";
	  cout << "That means that your monthly payment would be " << monthly_payment << ".\n";

	  cout << "Do you want to do it again?\n";
	  cout << "Press y for yes, press n for no: ";
	  cin >> ans;
	} while (ans == 'y' || ans == 'Y'); 

	cout << "Goodbye!\n";

	return 0;
}

I agree with VernonDozier. You're skipping a couple calculations that the problem gives you. It helps to write the actual problems out on a piece of paper and go over them mentally like a math problem before actually trying to write a code for it. Hope this helps :)

I guess face value is money neeeded.

My interpretation from the above description is that face_value = $1000, and money_needed = $775. You walk into the bank and walk out with $775 (money_needed). The total amount you pay back is $1,000, or the face value, as defined above. I've been cruising the internet and "face value" is a bit confusing to me. It seems more like a bond term than a regular old loan term, and it doesn't seem to be normally defined as it is above, at least with respect to loans, and it certainly isn't calculated as it is above.

Try this:

#include <iostream>
using namespace std;
int main()

{

	double face_value, new_face_value, interest_rate, total_interest, number_of_months, monthly_payment, time, interest;
	int const year = 12, percent_decimal = 100;
	char ans;
	
	do
	{
	  cout << "Enter the amount of money you need from a loan.\n";
	  cin >> face_value;
	  cout << "Enter the interest rate of the loan in percentage.\n";
	  cin >> interest_rate;
	  cout << "Now enter the duration of the loan in months.\n";
	  cin >> number_of_months;

	  interest = (face_value*interest_rate) / percent_decimal;
	  time = number_of_months / year;
	  total_interest = (face_value*time*interest);
	  new_face_value = (face_value+total_interest); 
  	  monthly_payment = (new_face_value/number_of_months);

  	  cout.setf(ios::fixed);
	  cout.setf(ios::showpoint);
	  cout.precision(2);

	  cout << "The amount of money you need to borrow is " << new_face_value << ".\n";
	  cout << "That means that your monthly payment would be " << monthly_payment << ".\n";

	  cout << "Do you want to do it again?\n";
	  cout << "Press y for yes, press n for no: ";
	  cin >> ans;
	} while (ans == 'y' || ans == 'Y'); 

	cout << "Goodbye!\n";

	return 0;
}

I agree with VernonDozier. You're skipping a couple calculations that the problem gives you. It helps to write the actual problems out on a piece of paper and go over them mentally like a math problem before actually trying to write a code for it. Hope this helps :)

You are multiplying face_value twice here, so you're going to get massive interest:

interest = (face_value*interest_rate) / percent_decimal;
	  
	  time = number_of_months / year;
	  total_interest = (face_value*time*interest);

Thanks a lot defychaos, but I still cannot make the thread as solved, because the math is still not correct

Thanks to everyone who tried, Im going to my professors office hours tomorrow to ask him for some help.

But Im really getting better on this, im doing it a lot more faster :D

total = needs / (1-(rate/100) * (months/12));

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.