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
Anna11 [10]
3 years ago
14

Write a recursive program that calculates the total tuition paid over certain number of years. The tuition goes up by 2.5% per y

ear. This method does not return any value. It displays the information and here is the call to the method and the sample output.
Computers and Technology
1 answer:
Lisa [10]3 years ago
8 0

Answer:

The program is as follows:

def calctuit(pay,n,yrs):

   if n == 0:

       return

   pay*=(1.025)

   print("Year ",yrs,": ",pay)

   calctuit(pay,n-1,yrs+1)

n = int(input("Years: "))

pay = float(input("Tuition: "))

yrs = 1

calctuit(pay,n,yrs)

Explanation:

The function begins here

def calctuit(pay,n,yrs):

This represents the base case

<em>    if n == 0:</em>

<em>        return</em>

This calculates the tuition for each year

   pay*=(1.025)

This prints the tuition

   print("Year ",yrs,": ",pay)

This calls the function again (i.e. recursively)

   calctuit(pay,n-1,yrs+1)

The function ends here

This gets the number of years

n = int(input("Years: "))

This gets the tuition

pay = float(input("Tuition: "))

This initializes the years to 1

yrs = 1

This calls the function

calctuit(pay,n,yrs)

You might be interested in
Consider the code below. When you run this program, what is the output if the temperature is 77.3 degrees Fahrenheit?
ryzh [129]

Answer:

The output would be "Wear short sleeves"

Explanation:

The temperature is 77.3 degrees and 77.3 > 70

3 0
3 years ago
Will give 5star and mark brainleist
TiliK225 [7]
9. C
10. B

Hope this helps!
7 0
3 years ago
Some one please tell me how to change my name on here?
levacccp [35]

Answer:

I have no idea I need points though

6 0
3 years ago
QUESTION 8
Finger [1]

Answer:

question 8 is true

Explanation:

PHP is a server-side scripting language for creating dynamic web pages. ... The PHP programming language receives that request, makes a call to the MySQL database, obtains the requested information from the database, and then presents the requested information to your visitors through their web browsers.

6 0
3 years ago
Using the "split" string method from the preceding lesson, complete the get_word function to return the {n}th word from a passed
lana66690 [7]

Answer:

def get_word(sentence, n):

# Only proceed if n is positive

   if n > 0:

       words = sentence.split()

# Only proceed if n is not more than the number of words

       if n <= len(words):

           return words[n-1]

   return (" ")

print(get_word("This is a lesson about lists", 4)) # Should print: lesson

print(get_word("This is a lesson about lists", -4)) # Nothing

print(get_word("Now we are cooking!", 1)) # Should print: Now

print(get_word("Now we are cooking!", 5)) # Nothing

Explanation:

Added parts are highlighted.

If n is greater than 0, split the given sentence using split method and set it to the words.

If n is not more than the number of words, return the (n-1)th index of the words. Since the index starts at 0, (n-1)th index corresponds to the nth word

8 0
3 years ago
Other questions:
  • What key combination in excel takes you back to the first cell
    7·1 answer
  • How is the Microsoft Word 2013 window organized?
    11·2 answers
  • What is an activity that can help you enhance the appearance of your computer's desktop?
    10·2 answers
  • And there you go <br> sorry its saying my thing is tooo small
    14·2 answers
  • Network administrators use _______ technology to get antivirus updates to be automatically downloaded on employees' workstations
    15·1 answer
  • When you evaluate the use of digital media, how has it affected the newspaper business? The rise of digital media has caused new
    8·1 answer
  • What are the main features cyber law of Nepal​
    13·1 answer
  • Jordan just wrote a secret message program in python that converts the number 7,095 to 1s and 0s. Which number system is Jordan
    8·2 answers
  • Which term describes the surrounding area of this image?
    10·1 answer
  • There are several categories of utility programs that were discussed in this unit. For this item, list one. In one to three sent
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!