1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ivanzaharov [21]
3 years ago
14

Python Code that predicts the amount of money you will have in your IRA when you retire. Inputs are: 1. Number of years until yo

u retire, it must be a whole number (integer) in the range 1 to 70. Any number outside of this range is to be rejected and the user will be required to enter the value again, this repeat must be done until a valid number is input. 2. Expected interest rate as a percent (this the average expected earnings per year until retirement is reached). The number must be 0 or greater, any other value will be rejected and as above, the user must be polled until a valid number is input. If the number is greater than 10%, the user must be asked if he/she really expects to earn this much, if the user replies in the affirmative, the number is to be used, otherwise the user will be asked to input the value again and the above checks will be made. 3. The initial amount in the IRA. This is a decimal number and may be any non-negative number. If a negative number is entered, the value is to be rejected and the user will be required to enter an acceptable value. Again, loop until a valid value is input. 4. The amount expected to be added to the IRA each year. This is a decimal number in the range of 0 to $2,500. The program must loop asking for this value until a valid value is entered. After the data is input and validated, the program is to loop printing out the value of the IRA every 5 years and the value at the end of the time entered as input #1. The value is to be computed in a loop where the value each year is determined by: value = value + (value)*rate + yearlyInput
Computers and Technology
1 answer:
zaharov [31]3 years ago
3 0

Answer:

yearsUntilRetire =0

expectedInterest =-1.00

initialAmount =-1.0

expectedAmountToAdd = -1.00

while yearsUntilRetire < 1 or yearsUntilRetire > 70:

yearsUntilRetire = int(input("Number of year until you retire between 1 to 70: "))

while expectedInterest <0 :

expectedInterest = float(input("enter the expected rate : "))

if expectedInterest >= 10:

doubleCheckRate = input("do you really expect {} interest rate: ".format(expectedInterest)).lower()

if doubleCheckRate == "false":

expectedInterest =-1.00

while initialAmount < 0:

initialAmount = float(input("Enter positive initial amount for IRA: "))

while expectedAmountToAdd < 0 or expectedAmountToAdd > 2500:

expectedAmountToAdd = float(input("Enter positive IRA amount to be added each year between 0 to $2500: "))

finalContribution =initialAmount

for i in range(yearsUntilRetire):

finalContribution = finalContribution + finalContribution * (expectedInterest/100.00) + expectedAmountToAdd

if (i+1) % 5 == 0:

print("Contribution after year {} is ${:,.2f}.".format(i+1,finalContribution))

 

print("Final Contribution is ${:,.2f}.".format(finalContribution))

Explanation:

  • Use a loop to get the valid input from the user for years until retire between 1 to 70 .
  • Get the valid input for expected rate .
  • Check if expected rate is greater than or equal to 10 then ask the user again if one expect such high rate .
  • Use a loop to get valid IRA initial Contribution .
  • Use a loop to get expected Amount to add regularly in IRA .
  • Iterate over numbers of year and print the data after 5 years .
You might be interested in
Cell B10 contains a date, such as 9/1/2014. Which formula determines how many days have passed between that date and the current
Jet001 [13]
<span>If using excel, you can use this formula: DATEDIF(start_date, end_date, unit) For instance, DATEDIF(9/1/2014, today, "d") or DATEDIF(B10, today, "d")</span>
3 0
3 years ago
Read 2 more answers
Who invent cars and who invent bikes and who invent pc
julia-pushkina [17]

Answer:

  • Cars were invented in 1886 by Karl Benz.
  • The term bicycle was coined in France in the 1860s, but The first verifiable claim for a practically used bicycle belongs to German Baron Karl von Drais in 1817
  • The first computer was by Charles Babbage, an English mechanical engineer and polymath he originated the concept of a programmable computer.

7 0
3 years ago
Give an original idea for an app idea to do with sports, please.
BlackZzzverrR [31]
Maden Mobile is an app for sports :)
5 0
4 years ago
Essay on the importance of computer and internet 250 word​
Alona [7]

With the significant progress in technology, the importance of the internet has only multiplied with time. The dependence on the internet has been because of multiple advantages that it has to offer – for instance reducing the work stress and changing the face of communication most importantly. By employing the correct usage of the internet, we can find various information about the world. The internet hosts Wikipedia, which is considered to be one of the largest best-composed reference books kept up by a vast community of volunteer scholars and editors from all over the world. Through the internet, one may get answers to all their curiosity. In the education sector too, it plays a major role, especially taking into consideration the pandemic. The Internet during the pandemic provided an easy alternative to replace the traditional education system and offers additional resources for studying, students can take their classes in the comforts of their homes. Through the internet, they can also browse for classes – lectures at no extra cost. The presence of the internet is slowly replacing the use of traditional newspapers. It offers various recreational advantages as well. It can be correctly said that the internet plays a great role in the enhancement of quality of life.

6 0
2 years ago
Read 2 more answers
Which of these completes the sentence? People interpret information ___________. Choose one.
evablogger [386]

Explanation:

mannejaondpsbma0jdjdhdj

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write an application program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the o
    5·1 answer
  • The disk drive is a secondary storage device that stores data by ________ encoding it onto circular disks.
    11·1 answer
  • 1. Show the 16-bit representation of the decimal number 2437. Show your steps. 2. Convert the 16-bit representation of part (a)
    12·1 answer
  • Explicit knowledge can be documented and codified, whereas tacit knowledge encompasses insights, judgment, creative processes, a
    9·1 answer
  • What will Jason need to assemble a microcomputer and connect it to memory chips
    8·1 answer
  • When do you need to use a fully qualified url in a hyperlink?
    6·1 answer
  • The _____________ RTN describes the overall effectof instructions on the programmer visible registers
    9·1 answer
  • ¿Cuál es la función que cumplía los sofistas y Porque eran tan importantes?​
    13·1 answer
  • IF YOU LOVE GOD HELP ME......What should be covered in the conclusion of a presentation?
    11·2 answers
  • If an algorithm created to help make hiring decisions is based on previous unfair decisions, then the algorithm may be
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!