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
When an event occurs, the agent logs details regarding the event. what is this event called?
Nimfa-mama [501]

If an event occurs, the agent logs details regarding the event. what is this event called GET.

The information in the agent log file is known to be the beginning of the log file, which is stated to show the agent's launch and handling of the services and configuration settings.

Keep in mind that the agent log also contains a history of the activities performed by the agent during runtime, along with any errors, and that it is utilised to investigate deployment issues.

As a result, if an event happens, the agent logs information about it. What is this GET event, exactly?

The agent monitoring services' startup and configuration settings are displayed at the log file's beginning. The sequence of agent runtime activity and any observed exceptions are also included in the agent log.

Learn more about agent logs:

brainly.com/question/28557574

#SPJ4

8 0
1 year ago
Which programming language was released first? FORTRAN BASIC Perl Pascal<br><br>ANSWER: FORTRAN (A)
julsineya [31]

Answer:

FORTRAN

Explanation:

  • The first programming language was FORTRAN .
  • It was released on 1957
  • About 65 years ago , when programming languages are at infant stage
8 0
1 year ago
Read 2 more answers
Use the arr field and mystery () method below.
kolezko [41]

Answer:

The sum of all positive even values in arr

Explanation:

We have an array named arr holding int values

Inside the method mystery:

Two variables s1 and s2 are initialized as 0

A for loop is created iterating through the arr array. Inside the loop:

num is set to the ith position of the arr (num will hold the each value in arr)

Then, we have an if statement that checks if num is greater than 0 (if it is positive number) and if num mod 2 is equal to 0 (if it is an even number). If these conditions are satisfied, num will be added to the s1 (cumulative sum). If num is less than 0 (if it is a negative number), num will be added to the s2 (cumulative sum).

When the loop is done, the value of s1 and s2 is printed.

As you can see, s1 holds the sum of positive even values in the arr

7 0
2 years ago
Is anyone excited for the new matrix coming out ?
Vinil7 [7]

Answer:

Yes, me!!

Explanation:

5 0
2 years ago
Read 2 more answers
Ethereum Mining Calculator Profitability and Difficulty Level?
yanalaym [24]

Profitability Calculator: https://www.cryptocompare.com/mining/calculator/eth?HashingPower=200&HashingUnit=MH%2Fs&PowerConsumption=140&CostPerkWh=0.12&MiningPoolFee=1

Difficulty Level Chart: https://www.coinwarz.com/difficulty-charts/ethereum-difficulty-chart

3 0
3 years ago
Other questions:
  • I want to customize my company's logo, name, address, and similar details in all my business documents what option should use?
    12·1 answer
  • What font option will elevate part of the text to a higher level and decrease its size? A. Subscript
    8·1 answer
  • An Internet Service Provider (ISP) is a company that builds the routers and wired connections that allow individuals to access t
    12·2 answers
  • Please answer this a due tomorrow!!!
    5·1 answer
  • The part of the computer that contains the brain or the Central Park nursing unit is also known as
    10·1 answer
  • Consider the packets exchanged in TCP connection setup between Host A and Host B. Assume that Host A's initial sequence number i
    7·1 answer
  • in java Write a program with total change amount in pennies as an integer input, and output the change using the fewest coins, o
    13·1 answer
  • What is the full meaning of Internet and WiFi
    6·2 answers
  • Name:
    11·1 answer
  • what will allow you to immediately exit the program without rebooting the computer, when you realize your browser is not respond
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!