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
Given positive integer numinsects, write a while loop that prints that number doubled without reaching 100. follow each number w
hichkok12 [17]
Hi,

the program is as follows
___________________________________________________________


import java.io.*;
class doubleval

  {
     public static void main()throws IOException   
     {

       DataInputStream dt=new DataInputStream(System.in); 

System.out.println("Enter NUMBER WHOSE DOUBLE U WANT TO                                           PRINT");       
            int n=Integer.parseInt(dt.readLine()); 

                  for(int i=n;i<=100;i=2*i)       
                    {           
                         System.out.println(i);       
                            }   
            }
}


           
3 0
3 years ago
What is peopleware?<br>need help​
Oksana_A [137]

Answer:

Peopleware is a term used to refer to one of the three core aspects of computer technology, the other two being hardware and software.

3 0
3 years ago
Y’all think Super Drags is good?
Kryger [21]

Yeah, I'm into it. It does show a lot of stereotypical views on drag queens, and it goes a little over the top, but honestly? The LGBT community has spent so long acting like the general population, and we're expected to be a sort of cookie cutter outline of the ideal person in order to fit in. We're not really allowed to be silly and have fun, otherwise we just get labeled as a stereotype, which sucks. When you're queer, you get labeled as that before anything else: your interests are seen as a byproduct of your queerness, not as an interest. So Super Drags, is actually a nice sort of change of pace. It's silly, it shows that queer people are human, and it sorta shows that "Yass bih" look on life, which is hilarious imo. Plus hey, Brazilian LGBT show that doesn't spout homophobic propaganda and supports diversity within all aspects of life? I'll support that.

TLDR; There aren't many silly shows out there that have an LGBT cast. Like, it's always supposed to be grim and sad, and all about heartbreak and coming out, yadda yadda yadda. So, it's cool that we've finally got something lighthearted.

3 0
3 years ago
Assume the variable sales references a float value. Write a statement that displays the value rounded to two decimal points.Assu
romanna [79]

Answer:

The statement is as follows:

print("{0:,.1f}".format(number))

Explanation:

Required

Statement to print 1234567.456 as 1,234,567.5

To do this, we make use of the format keyword, and we set the print format in the process.

To round up number to 1 decimal place, we use the following format:

"{0:,.1f}"

To include comma in the thousand place, we simply include a comma sign before the number of decimal place of the output; i.e. before 1

"{0:,.1f}"

So, the print statement is:

print("{0:,.1f}".format(number))

3 0
3 years ago
What is the difference between a learner’s license and a driver’s license?
kirill115 [55]

privilege to operate a motor vehicle-drivers License

Able to get when 15. Valid for 1 yr. Allows you to drive with a parent in the car. $15. Bring social security and birth certificate to the DLD. Have for 6 months (and do 40 hrs) before getting license.-Learner Permit

4 0
3 years ago
Other questions:
  • As you are researching RAM for a computer you are building that will be used as a home office server for his small business. The
    5·2 answers
  • Explain the function of the Ribbon in Microsoft Word.
    15·1 answer
  • For security reasons a network administrator needs to ensure that local computers cannot ping each other. which settings can acc
    5·1 answer
  • 1. Pasar los siguientes ejercicios a diagrama de bloque
    11·1 answer
  • Help me please I’m failing
    11·1 answer
  • What is the main fuction of command interpreter​
    11·1 answer
  • Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout &lt;&lt; fixed
    7·1 answer
  • What skills did Carl work on, and what steps did he take to reach his long term goals?<br>​
    10·1 answer
  • Which type of network consists of multiple Windows computers that share information, but no computer on the network serves as an
    15·1 answer
  • Why does my laptop keep disconnecting from the wifi.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!