Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Math question. Haaaalp

  1. #1
    The Original Reputation: 1538 PrivateParts's Avatar
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    4,812

    Default Math question. Haaaalp

    Im trying to figure out the math for programming question but my brain isnt working.

    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, yielding $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 only $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.

    So
    1000 x (.15 x 1.5) = 225
    1000 - 225 = 775
    Thats simple

    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.



    Ok, lets just say the consumer needs 775 dollars instead of 1000 right now. The consumer would need a face value of 1000 bucks.

    I need to figure out how to get 1000 from the three inputs:
    needs to received = 775
    interest rate = 15%
    duration = 18 months (1.5 years)


    I cant figure out how to get 1000 bucks in face value out of these three inputs. Or 225 out of them.



    haaaalp. This isnt part of any assigment. Its just making me crazy not being able to figure it out after reading and trying it.

    Curse you alcohol and your many days of intoxication!

  2. #2
    Seņor Member Reputation: 393
    Join Date
    Feb 2008
    Location
    Loco's Biatch
    Posts
    2,261

    Default Re: Math question. Haaaalp

    Math is fun.

    Look at your initial equation:

    1000 x (.15 x 1.5) = 225
    1000 - 225 = 775


    now plug in the variables instead of exactly values

    F * (i * d ) = x
    F - x = n

    which can be assembled into:

    F - [F * (i * d )] = n

    Where:

    F - face value
    i - interest (decimal)
    d - duration (years)
    n - needed

    now we provide i, d and n and want to get F. so simply, solve for F

    F - [F * (i * d )] = n
    F * [ 1 - (i * d) ] = n

    F = n / [ 1 - (i * d) ]



    shazing

  3. #3
    The Original Reputation: 1538 PrivateParts's Avatar
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    4,812

    Default Re: Math question. Haaaalp

    Terrorismmmmmm


    My math is rusty, i get everything except how did the F become a 1. factored or something?

  4. #4
    Do Not Ask Reputation: 1397 Maxey's Avatar
    Join Date
    Feb 2008
    Posts
    7,504

    Default Re: Math question. Haaaalp

    My head assplodes.

  5. #5
    Seņor Member Reputation: 393
    Join Date
    Feb 2008
    Location
    Loco's Biatch
    Posts
    2,261

    Default Re: Math question. Haaaalp

    Quote Originally Posted by PrivateParts
    Terrorismmmmmm


    My math is rusty, i get everything except how did the F become a 1. factored or something?
    Yup, I factored it out. It's just like:

    (a - ab) = a(1 - b)

  6. #6
    The Original Reputation: 1538 PrivateParts's Avatar
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    4,812

    Default Re: Math question. Haaaalp

    Ah, the F * was throwing me off. Since its still * even without the symbol there.

    Anyway thanks.


    I dont start classes till monday. Maybe ill do this program aswell for the lab as bonus marks.
    Though most likely ill just end up waiting until the day before my other work is due.

  7. #7
    Seņor Member Reputation: 393
    Join Date
    Feb 2008
    Location
    Loco's Biatch
    Posts
    2,261

    Default Re: Math question. Haaaalp

    That is easy, it's like 10 lines of code. What language are you writing it in?

  8. #8
    The Original Reputation: 1538 PrivateParts's Avatar
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    4,812

    Default Re: Math question. Haaaalp

    C++

  9. #9
    Seņor Member Reputation: 393
    Join Date
    Feb 2008
    Location
    Loco's Biatch
    Posts
    2,261

    Default Re: Math question. Haaaalp

    Code:
    #include <iostream>
    
    using namespace std;
    
    void main()
    {
    	float needed, interest, yourMom;
    	cout << "Bitch give me your need: ";
    	cin >> needed;
    	cout << "Interest (as decimal): ";
    	cin >> interest;
    	cout << "Duration (years): ";
    	cin >> yourMom;
    	cout.setf(ios::fixed,ios::floatfield);
    	cout.precision(2);
    	cout << "Your face value is $" << needed / ( 1 - interest * yourMom ) << ". Also cocks. " << endl;
    	
    	system("PAUSE");
    
    	return;
    }
    note this does not check if the input is indeed numeric and will fail if it's not.

    Also, I want 10% of all your earning from this point on

  10. #10
    LEMONHAM Reputation: 156 Leomhann's Avatar
    Join Date
    Jul 2008
    Location
    In your closet
    Posts
    3,865

    Default Re: Math question. Haaaalp

    I think I just pulled an exorcist with the head spinning
    "I'm always the idiot charging into a room with a perfectly good, loaded gun and starts punching folks in the face"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •