Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3346794
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:20:45+00:00 2026-05-18T01:20:45+00:00

Present value is the value on a given date of a future payment or

  • 0

Present value is the value on a given date of a future payment or series of future payments, discounted to reflect the time value of money and other factors such as investment risk. Present value calculations are widely used in business and economics to provide a means to compare cash flows at different times on a meaningful “like to like” basis.

http://en.wikipedia.org/wiki/Present_value

What would be the best way to tackle this in an Objective-C function?

double retire62 = [benefit62.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];
double retire66 = [benefit66.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];
double retire70 = [benefit70.text doubleValue] * [yearlyReturn.text doubleValue] *12* [lblAgeExpectancy.text doubleValue];

Im just not familiar with Present Value/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:20:45+00:00Added an answer on May 18, 2026 at 1:20 am

    Putting aside your code snippet for a little while, the present value calculation itself is reasonably straightforward, a least in its simpler forms. (It can become a fair bit more complicated if you start to consider more realistic interest with different rates at different terms and such, but if you want to get into that you’ll need to do some proper reading up.)

    The present value of any single future cash flow is the amount of money you would have to invest now (at the so-called risk-free rate) in order to have the future amount when the time comes. That is, it is the future amount discounted at the specified interest rate.

    As a trivial example, suppose you are going to give me $105 in a year’s time, and the annual interest rate is 5%. If I have $100 now and invest it at that rate, in a year’s time I will have $105, the same amount you are due to give me. So the present value of that future $105 is not $105, but only $100. (This is just a slightly more formal equivalent of observing that a bird in the hand is worth two in the bush.)

    Let’s take a marginally more realistic example just to see how the calculation works. Suppose I’m due to receive $1000 in 5 years — how much is that worth to me now?

    Assume again that the relevant interest rate is 5% per year, and further assume that it is compounded annually — which is to say, after a year the first 5% is added to the original amount and this combined amount then accrues interest over the second year, and so on. After each year I have the amount I started with the beginning plus the 5% interest on the amount — that is 1.05 times what I started with at the beginning of the year. So after five years I would have 1.05 * 1.05 * 1.05 * 1.05 * 1.05 times as much as I had right at the beginning. To have $1000 in five years I would have to invest $1000 / 1.05 * 1.05 * 1.05 * 1.05 * 1.05, or about $784 — and that’s the present value of that $1000.

    More generally, you would need to divide the future amount by pow(1 + r, n) for interest rate r and number of years n (or equivalently multiply by pow(1 + r, -n)), and there are simple generalizations for where the interest rate and payments are over different periods (eg, annual rate compounded monthly). See, eg, Wikipedia’s compound interest entry for more detail.

    OK, back to the question. Coding this calculation in Objective-C is no different from coding it in C. Again using the simple version described above:

    double presentValue ( double futureValue, double annualRate, unsigned int years )
    {
        return futureValue * pow ( 1 + annualRate, -years );
    }
    

    You could do this as an Obj-C method rather than a C function, but the essence would be pretty similar. Adding more sophistication in terms of compounding periods and such is left as an exercise.

    Note, however, that this doesn’t bear very much resemblance to your own code, which looks to be just grabbing values blindly from text fields and multiplying them together. If you find yourself doing maths directly on the contents of views, you probably ought to be hearing alarm bells somewhere.

    Not wishing to sound too high-horsey, but it seems to me that you need much more clearly to distinguish the underlying data (we could call it the model if we were being fancy) from the inputs (in other words, what is the user actually providing and what is the program expected to know how to do without them having to think about it). And furthermore, both these things should be considered separately from the UI elements used to represent them.

    In other words, you probably need to revisit the whole Model-View-Controller pattern that every iPhone developer is supposed to have tattooed on their heart 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Present Value is the value on a given date of a future payment or
I need to present a wizard once, the first time my windows forms application
I am having trouble writing a query to select one row per date, given
I use a VB6/COM+ application which outputs date/time values based on the short date
At present it seems that VS2008 still isn't supported either in the 5.1.5 release
To present user specific data, where do I store the userID of the user
My present contract engagement is at a large E-Commerce company. Their code base which
At present I am using eclipse for JAVA project. I always wanted to use
How can I present a control to the user that allows him/her to select
I need to present the user with a matrix of which one column is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.