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
inn [45]
3 years ago
13

Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percen

t interest for one year. Create a separate method to do the calculation and return the result to be displayed.

Computers and Technology
2 answers:
avanturin [10]3 years ago
8 0

Answer:

# main function is defined

# the calculateAmount is called here

def main():

   print("The new amount is: ", calculateAmount(), sep="")

   

# calculateAmount function that calculate the interest

def calculateAmount():

   # the value of principal is p

   p = 5000

   # the value of rate is r

   r= 2

   # the time is t

   t = 1

   # the formula for finding interest

   interest = (p * r * t) / 100

   # the new amount is calculated

   amount = p + interest

   # the amount is returned

   return amount

# a call that make main function begin execution

if __name__ == "__main__":

   main()

Explanation:

The program is written in Python and it is well commented. A screenshot is attached showing program output

Wewaii [24]3 years ago
4 0

Answer:

public class num7 {

   /* Interest = (Principal *Rate*Time)/100

       Total amount you will have = principal (5000)+Interest

    */

   public static void main(String[] args) {

       double prinAmount = 5000;

       System.out.println("The total amount is "+(calInterest(prinAmount)));

   }

   static double calInterest(double principal){

       int time =1;

       double rate = 2.0;

       double interest = (principal*rate*time)/100;

       double principalPlusInterest = principal+interest;

       return principalPlusInterest;

   }

}

Explanation:

The Logic for this program is:

Interest = (Principal *Rate*Time)/100

Total amount you will have = principal (5000)+Interest

The method calInterest()  accepts a double parameter (principal Amount) and uses the logic above to calculate and return the total amount.

The Main Method calls calInterest() and outputs the value calculated in this case since it is hardcoded 5100

You might be interested in
How much does 1 American tank cost on gas for a regular mission? Depending on your answer, I will give you the right amount of p
dem82 [27]
Most of the cars or other vehicles in the United States regularly have tanks that can hold up to 12 gallons worth of gas. The price of gas in not consistent. Sometimes prices are high and sometimes prices are low. Just like to day the price of a gallon is worth $2.2. But in an average, gas costs $3.8 per gallons. Therefore, on a regular basis a standard American which can hold 12 gallons costs $46.2.
5 0
3 years ago
Inattentional blindness occurs when individuals do not observe certain objects or events because they are focused on something e
PSYCHO15rus [73]
The answer is True have a good day
5 0
4 years ago
Read 2 more answers
When determining the cost of an item, the seller will often analyze the demand as well as the supply before setting the price of
juin [17]

Answer:

The price of a commodity is determined by supply and demand. therefore the answer is COMMODITY. that other person is wrong

7 0
3 years ago
Is co2+4h2--> ch4 + 2h2o a combustion​
Nadya [2.5K]

Answer:

No its not a combustion its a formation.

Explanation:

7 0
3 years ago
How many bytes is a yobibyte
Tanzania [10]
i think the answer is 1 x 10^24 bytes
6 0
3 years ago
Read 2 more answers
Other questions:
  • In your own words, describe the advantages and disadvantages of the auto-negotiation protocol used in Ethernet communications.
    6·1 answer
  • HURRY
    5·1 answer
  • Most colleges require blank years of foriegn language for admission
    9·1 answer
  • Invalid length parameter passed to the LEFT or SUBSTRING function (below)".
    6·1 answer
  • Can a msi b450 tomahawk motherboard fit into a darkflash dlm21 mesh micro atx tower
    13·1 answer
  • What is pure carbon made of
    14·2 answers
  • One tool of Lean that is a container, card, or visual limit that signals when work needs to be done or replenishment needs to be
    13·1 answer
  • A user attempts to log in to a Windows PC, but the computer returns to the login screen after entering the correct username and
    12·1 answer
  • PLEASE HELP ASAP
    7·1 answer
  • What is the purpose of a computer virus? O to spread a disease to humans O to substitute for a human disease a O to disrupt a co
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!