Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are going to create a simple simulation that will track how much we can save for retirement between graduating college and reaching retirement age.

We are going to create a simple simulation that will track how much we can save for retirement between graduating college and reaching retirement age. To do this: Create a variable that represents our savings. Initially this variable should contain the number 0. Create a variable to represent our income. This should hold the number 58000 (i.e. $58,000, which is the median income of a college graduate in the USA). Write a for loop, that starts at age 22 (when you leave college) and runs until age 65 (the full retirement age). Each iteration of the for-loop should represent one year. Within the for-loop, calculate how much money you have saved by the end of this year and then assign this number to the savings variable. You can calculate this new value as: savings=previous savings+additional money saved this year+interest on previous savings Assume that you will save 10% of your salary each year, and that you earn 6% interest on existing retirement savings. Here is a code template that you might find helpful to implement the previous three bullet points: savings <- ... income <- ... interest_rate <- ... savings_rate <- ... for(year in ...){ savings <- savings +

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Vanishing American Corporation Navigating The Hazards Of A New Economy

Authors: Jerry Davis, Gerald F Davis

1st Edition

1626562792, 9781626562790

More Books

Students also viewed these Economics questions

Question

Case : Karl and June Monroe

Answered: 1 week ago