• Startseite
  • Tutorials
  • Kontakt
  • Mein Account
Panjutorials
  • Startseite
  • Tutorials
  • Kontakt
  • Mein Account

Exercise for Arrays in CSharp

Now that you are a professional, as far as arrays are concerned, it is be time to prove it and solve this practice with bravura! 🙂

Todo:

  • Create a program that asks the user how much money he wants to invest monthly.
  • Then calculate at a value of 7% growth per year how much money the user has for the next 30 years (per year) have saved.
  • To keep it simple, his money always grows by the end of the year by 7%
  • Create an array where the value of the accumulated assets is saved for each year
  • Also create a variable in which the purchasing power from today’s perspective is saved. (Purchasing power = how much the money is worth from today’s point of view, with an inflation of 2.5% per year).
  • Ask the user for a number (this number is the years since the start of the investment) and then give him both the value of the asset and the purchasing power for the year (which the user entered, ie, for example, the beginning was 2015 and he enters 25, then it is the year 2040 – but work with the values ​​0-30 and not 2015-2045).
  • While this involves a lot of mathematics, we have dealt with everything necessary to solve the problem. Please solve the challenge with arrays. I know it would simpler to go with a simple calculation, but it wouldn’t help you in regards to arrays.

As always, there is the solution in the next article.

By the way, to check whether your program calculates correctly, you should have a fortune of € 52,638.21 and a purchasing power of € 32,123.57 at € 100 monthly investment after 20 years. You have in the time yes just 24,000€. So you see, if you do this, you can more than double your assets in 20 years and increase your purchasing power by at least 30%. 7% growth is achieved by investing very cautiously on the stock market in the long term.

I wish you success!