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
Write a program consisting of: a. A function named right Triangle() that accepts the lengths of two sides of a right triangle as
Lunna [17]

Answer:

The java program is as follows.

import java.lang.*;

public class Triangle

{

   //variables to hold sides of a triangle

   static double height;

   static double base;

   static double hypo;

   //method to compute hypotenuse

   static double rightTriangle(double h, double b)

   {

       return Math.sqrt(h*h + b*b);

   }

public static void main(String[] args) {

    height = 4;

    base = 3;

    hypo = rightTriangle(height, base);

 System.out.printf("The hypotenuse of the right-angled triangle is %.4f", hypo);

}

}

OUTPUT

The hypotenuse of the right-angled triangle is 5.0000

Explanation:

1. The variables to hold all the three sides of a triangle are declared as double. The variables are declared at class level and hence, declared with keyword static.

2. The method, rightTriangle() takes the height and base of a triangle and computes and returns the value of the hypotenuse. The square root of the sum of both the sides is obtained using Math.sqrt() method.

3. The method, rightTriangle(), is also declared static since it is called inside the main() method which is a static method.

4. Inside main(), the method, rightTriangle() is called and takes the height and base variables are parameters. These variables are initialized inside main().

5. The value returned by the method, rightTriangle(), is assigned to the variable, hypo.

6. The value of the hypotenuse of the triangle which is stored in the variable, hypo, is displayed to the user.

7. The value of the hypotenuse is displayed with 4 decimal places which is done using printf() method and %.4f format specifier. The number 4 can be changed to any number, depending upon the decimal places required.

8. In java, all the code is written inside a class.

9. The name of the program is same as the name of the class having the main() method.

10. The class having the main() method is declared public.

11. All the variables declared outside main() and inside another method, are local to that particular method. While the variables declared outside main() and inside class are always declared static in java.

4 0
3 years ago
Roger is part of a team that is responsible for employing a new information system, the design of which was developed using cust
antoniya [11.8K]

Answer:

A line with a diamond on one end

Explanation:

A line with a diamond on one end is used as a symbol for condition.

In a structured programming chart, condition represents the fact that one program module (a control module) determines subordinate modules that will be invoked.

5 0
3 years ago
What technology has had the most significant influence on engineering?
Lorico [155]
The wheel (: would be the correct answer
5 0
2 years ago
When a peanut farmer adds value to his peanuts by turning them into creamy peanut butter, the farmer is engaging in which of the
Neporo4naja [7]

Answer:

The correct options are;

The security administrator makes sure to shred and properly dispose of any printed confidential information

The security administrator uses password-protected files and folders on his work computer

Explanation:

A company's policies as written in the employee manual, with regards to confidentiality, generally includes provisions and procedures on how to handle confidential information, including the requirement for the shredding of of printed confidential information that are to be disposed, such as information about the way the company operates, the earnings of the company and employee records

Password protection keeps confidential files and folders from being able to be accessed by people without the prerequisite authority, which ensures the confidentiality of the company's information is maintained.

3 0
3 years ago
Part of preforming routine computer maintenance includes
schepotkina [342]
Deleting internet browsing history
6 0
3 years ago
Other questions:
  • Write a SELECT statement that returns these three columns: vendor_nameThe vendor_name column from the Vendors table default_acco
    13·1 answer
  • When selecting font size in a document, ____ points equals one-inch-tall text?
    10·1 answer
  • Program:
    11·1 answer
  • One vital component of your professional behavior with regard to computing systems today is the creation of​ _________.
    14·1 answer
  • Answer to this if you have apex legends on either pc xbox one or PS4 for the one that answers and does gets brainliest please do
    11·2 answers
  • Misperceptions can lead to miscommunication. List an example from the article.(site 1)
    10·2 answers
  • Which option is considered a part of the document that is used to collect specific and predefined information?
    7·1 answer
  • The best way to ensure the accuracy and safety of your accounts is to:
    10·1 answer
  • When text is used as a Hyperlink, it is usually underlined and appears as a different color.
    11·1 answer
  • each data mining technique has its advantages and limitations. which data mining technique mimics the neural structure of the br
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!