answer.
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
Oduvanchick [21]
1 year ago
11

python Write a function that computes a future investment value at a given interest rate for a specified number of years. The fu

ture investment is determined using the formula in Programming Exercise 2.19 in Chapter 2 Programming Exercise from the Book.
Computers and Technology
1 answer:
Svetlanka [38]1 year ago
4 0

Answer:

def future_investment_value(investment, monthly_interest_rate, years):

  print("Years\tFuture Value")

  print("- - - - - - - - - - -")

  for i in range(1, years+1):

      future_value = investment * ((1 + monthly_interest_rate) ** (12 * i))

      print(i, "\t\t", format(future_value, ".2f"))

investment = float(input("Enter the invesment amount: "))

interest = float(input("Enter the annual interest rate: "))

year = int(input("Enter the year: "))

future_investment_value(investment, interest/1200, year)

Explanation:

Inside the function:

- In the for loop that iterates through the years, calculate the future value using the formula and print the results

Then:

- Ask the user for the investment, annual interest rate, and year

- Call the function with the given inputs

You might be interested in
Which two functions are provided to users by the context-sensitive help feature of the Cisco IOS CLI? (Choose two.)
Svetach [21]

Answer:

B. displaying a list of all available commands within the current mode*

D. determining which option, keyword, or argument is available for the entered command*

Explanation:

Cisco IOS are known for using Command line interface(CLI) that allows execution of certain commands

Cisco system make use devices such as router, switch and others. All these Commans comes with privileged levels that gives access to user that have privilege to access between level 0 and 15.

It should be noted that two functions that are provided to users by the context-sensitive help feature of the Cisco IOS CLI are ;

✓displaying a list of all available commands within the current mode

✓ determining which option, keyword, or argument is available for the

5 0
2 years ago
Catherine wants to search online for fruit juices. She is fine with aerated or fresh fruit juices. Which Boolean operator will e
ZanzabumX [31]
<h2>Answer:</h2>

<u>She will use the </u><u>OR Boolean operator</u>

<h2>Explanation:</h2>

Boolean Operators are used to connect and define the relationship between your search terms. Doing searching in any electronic databases like Google search engine, we use Boolean operators to either narrow or broaden our searches. The three Boolean operators are AND, OR and NOT. Among these operators OR is used to add the items. Since Catherine is searching for aerated or fresh fruit juices so she needs both the results therefore she must use OR operator.


8 0
2 years ago
Read 2 more answers
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
victus00 [196]

Answer:

I am writing a Python program.

def concordance(filename):  # function that takes a file name as parameter and returns the concordance for that file

   file = open(filename,"r")  #opens file in read mode

   unique={}  #creates and empty list

   for word in file.read().split():  #loops through every word in the file

       if word in unique:  # if words is already present in the list

           unique[word] += 1  #add 1 to the count of the existing word

       else:    #if word is not present in the list

           unique[word] = 1 #add the word to the list and add 1 to the count of word

           file.close();  # close the file

   for x in sorted(unique):  #sort the list and displays words with frequencies

       print(x, unique[x]);  #prints the unique words and their frequencies in alphabetical order

#prompts user to enter the name of the file

file_name=input('Enter the input file name: ')

concordance(file_name)  #calls concordance method by passing file name to it

Explanation:

The program has a function concordance that takes a text file name as parameter and returns a list of unique words and their frequencies.

The program first uses open() method to open the file in read mode. Here "r" represents the mode. Then creates an empty list named unique. Then the for loop iterates through each word in the file. Here the method read() is used to read the contents of file and split() is used to return these contents as a list of strings. The if condition inside the loop body checks each word if it is already present in the list unique. If the word is present then it adds 1 to the count of that word and if the word is not already present then it adds that unique word to the list and assign 1 as a count to that word. close() method then closes the file. The second for loop for x in sorted(unique):  is used to display the list of unique words with their frequencies. sorted() method is used to sort the list and then the loop iterates through each word in the list, through x, which acts like an index variable, and the loop displays each word along with its frequency.

6 0
1 year ago
Write a class for a Cat that is a subclass of Pet. In addition to a name and owner, a cat will have a breed and will say "meow"
fenix001 [56]

Answer:

The Java class is given below with appropriate tags for better understanding

Explanation:

public class Cat extends Pet{

  private String breed;

 public Cat(String name, String owner, String breed){

      /* implementation not shown */

      super(name, owner);

      this.breed = breed;

  }

  public String getBreed() {

      return breed;

  }

  public void setBreed(String breed) {

      this.breed = breed;

  }

  public String speak(){ /* implementation not shown */  

      return "Purring…";

  }

}

8 0
1 year ago
Write a public static method named printArray, that takes two arguments. The first argument is an Array of int and the second ar
Serjik [45]

Answer:

Written in Java

public static void printArray(int myarr[], String s){

       for(int i = 0; i<myarr.length;i++){

           System.out.print(myarr[i]+s);

       }

   }

Explanation:

This defines the static method alongside the array and the string variable

public static void printArray(int myarr[], String s){

The following iteration iterates through the elements of the array

       for(int i = 0; i<myarr.length;i++){

This line prints each element of the array followed by the string literal

           System.out.print(myarr[i]+s);

       }

   }

The method can be called from main using:

<em>printArray(myarr,s);</em>

Where myarr and s are local variables of the main

5 0
1 year ago
Other questions:
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • You have been tracking your exercise routine, which involves running, lifting weights, yoga, and stretching. You want to see wha
    15·2 answers
  • Manny is a personal trainer. He gives his client an endurance test each week. He would like to illustrate how much the client ha
    7·2 answers
  • Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only
    9·2 answers
  • 14.28. Consider the relation R, which has attributes that hold schedules of courses and sections at a university; R = {Course_no
    7·1 answer
  • 7.8.1: Function pass by reference: Transforming coordinates. Define a function CoordTransform() that transforms the function's f
    6·1 answer
  • For a class project, Jerome builds a simple circuit with a battery and three light bulbs. On his way to school, Jerome drops his
    9·1 answer
  • Jim is writing a program to calculate the wages of workers in a teddy bear factory.
    7·1 answer
  • Which of these are characteristics of a Python data type? Check all that apply.
    11·1 answer
  • Which are types of lines? Choose three answers.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!