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
The options are file protection , fault-tolerance , fault line , file tolerance , and the question is which term describes the d
VikaD [51]

Answer:

I would say (b) fault tolerance

5 0
3 years ago
Which of the following describe ALAC audio files? Choose all that apply.
Vitek1552 [10]

Answer:

B,C,D

Explanation:

6 0
3 years ago
Read 2 more answers
Another name for the office button menu is the toolbar. true or false.
levacccp [35]
This statement is true im sure of it
8 0
3 years ago
Read 2 more answers
Write a function named joinStrings() that keeps asking the user for words and joins them together. Each word should start with a
Tamiku [17]

Answer:

* The code is in Python

def joinStrings():

   join = ""

   while True:

       str = input("Enter a word or Q to stop: ")

       if str == "Q":

           break

       else:

           join = join + " " + str

   return join

print(joinStrings())

Explanation:

Create a function called joinStrings

Initialize join variable to hold the strings that will be combined

Create a while loop that stops when user enters "Q". Otherwise, ask the user for a new string and join it to the join variable with a space

When the loop is done, return the join

Call the function and print the result

4 0
3 years ago
What is the least number of options you should come up with to help you solve a problem?
Lubov Fominskaja [6]

Answer:

Comparing
Whole
Numbers

Symbols
are
used
to
show
how
the
size
of
one
number
compares
to
another.


These
symbols
are
<
(less
than),
>
(greater
than),
and
=
(equals).

For
example,
since
2
is
smaller
than
4
and
4
is
larger
than
2,
we
can
write:
2
<
4,
which


says
the
same
as
4
>
2
and
of
course,
4
=
4.


• To
compare
two
whole
numbers,
first
put
them
in
numeral
form.


• The
number
with
more
digits
is
greater
than
the
other.


• If
they
have
the
same
number
of
digits,
compare
the
digits
in
the
highest
place
value


position
(the
leftmost
digit
of
each
number).
The
one
having
the
larger
digit
is

greater
than
the
other.


• If
those
digits
are
the
same,
compare
the
next
pair
of
digits
(look
at
the
numbers
to


the
right).


• Repeat
this
until
the
pair
of
digits
is
different.
The
number
with
the
larger
digit
is


greater
than
the
other.


Example:
402
has
more
digits
than
42,
so
402
>
42.


Example:
402
and
412
have
the
same
number
of
digits.


We
compare
the
leftmost
digit
of
each
number:
4
in
each
case.


Moving
to
the
right,
we
compare
the
next
two
numbers:
0
and
1.


Since
zero
is
less
than
one,
402
is
less
than
412
or
402<412.

Explanation:

8 0
3 years ago
Other questions:
  • If you have a rubric, “your teacher can prove you knew what you were supposed to do.” T/F
    10·2 answers
  • What is Napoleon's friend's name? From the Napoleon Dynamite movie.
    14·1 answer
  • 1. ________ is often defined as using illicit (illegal) drugs, or when the drug is alcohol, tobacco, or a legitimate drug (presc
    13·1 answer
  • What is a thesaurus is best used for​
    11·2 answers
  • Diane is receiving a lot of unwanted e-mail. What steps can she take to reduce the amount of e-mail she receives?
    12·1 answer
  • How do I select cells A3 through F3 in Excel 2013
    14·1 answer
  • Remember partially filled arrays where the number of elements stored in the array can be less than its capacity (the maximum num
    14·1 answer
  • A clearly stated objective that how program should work and how it respond to a error is called??
    14·1 answer
  • Can someone compress this ipv6 address? 558c:0000:0000:d367:7c8e:1216:0000:66be
    9·1 answer
  • What is the purpose of a computer network needs assessment? to evaluate how to move from the current status to the desired goal
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!