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
Ratling [72]
2 years ago
10

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

ent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed.
b. Modify the program in Excercise 3a so that the main program prompts the user for the amount of money and passes it to the interest calculating method.

c. Modify the program in Excercise 3b so that the main program also prompts the user for the interest rate and passses both the amount of money and the interest rate to the interest calculating method.

// Pseudocode PLD Chapter 9 #3 pg. 421

// Start

// Declarations

// num amount

// num newAmount

// num interestRate

// output "Please enter the dollar amount. "

// input amount

// output "Please enter the interest rate(e.g., nine percet should be entered as 9.0). "

// input interestRate

// newAmount = FutureValue(amount,interestRate)

// output "The new dollar amount is ", newAmount

// Stop

//

//

//

// num FutureValue(num initialAmount, num interestRate)

// Declarations

// num finalAmount

// finalAmount = (1 + interestRate/100) * initialAmount

// return finalAmount
Computers and Technology
1 answer:
lianna [129]2 years ago
7 0

Answer:

see explaination

Explanation:

a)

amount = 5000

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

###### function ######

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

b)

amount <- enter amount

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

###### function ######

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

c)

#include <iostream>

using namespace std;

// function defination

double calculateInterest(double amount, double rate, int year);

int main(){

double amount, rate;

int year = 1;

cout<<"Enter amount: ";

cin>>amount;

cout<<"Enter rate: ";

cin>>rate;

// calling method

double interest = calculateInterest(amount, rate, year);

cout<<"Amount after 1 year: "<<(amount+interest)<<endl;

return 0;

}

// function calculation

double calculateInterest(double amount, double rate, int year){

return (amount*rate*year)/100.0;

}

You might be interested in
Describe the indicators and hazards of a metal deck roof fire in an unprotected steel joist warehouse as well as the techniques
cestrela7 [59]

Answer:

Explanation:

Joist mansory building is a type of building with the exterior wall of mansory, which is capable of withstanding combustion or fire for nothing less than an hour.

Therefore, the best method to deal with fire is to build with materials that are fire resistant.

8 0
2 years ago
If you were investigating login issues on a Windows computer, which portion of the Event Viewer logs would be a good place to st
USPshnik [31]

Answer:

If we are investigating login issues then we have to start with 'security logs' in 'windows logs' portion of Event viewer.

Explanation:

Much information about login issues is contained in log files which are related to security because it is mostly security issue. Some it is also better to start with 'system logs' portion of windows logs portion of Event viewer when there may be system problems instead of security issues. But in most cases there is security issues so 'security logs' is better option overall

6 0
2 years ago
Give a recursive algorithm to compute the sum of the cubes of the first n positive integers. The input to the algorithm is a pos
DaniilM [7]

Answer:

def sum_cubes(n):

   if n == 1:

       return 1

   else:

       return n * n * n + sum_cubes(n-1)

print(sum_cubes(3))

Explanation:

Create a function called sum_cubes that takes one parameter, n

If n is equal to 1, return 1. Otherwise, calculate the cube of n, and add it to the sum_cubes function with parameter n-1

If we want to calculate the cubes of the first 3 numbers:

sum_cubes(3) = 3*3*3 + sum_cubes(2)

sum_cubes(2) = 2*2*2 + sum_cubes(1)

sum_cubes(1) = 1

If you substitute the values from the bottom, you get 27+8+1 = 36

7 0
2 years ago
A layer 2 switch is used to switch incoming frames from a 1000base-t port to a port connected to a 100base-t network. which meth
fredd [130]
<span>Shared memory buffering would work best. This would give the ports the best allocation of resources, using only those that are the most active and best allocated for the size of the frames being transmitted in the current traffic. In addition, any port can store these frames, instead of being specifically allocated as per other types of memory buffering.</span>
7 0
2 years ago
Write a recursive, string-valued method, replace, that accepts a string and returns a new string consisting of the original stri
ch4aika [34]

Answer:

Check the explanation

Explanation:

public String replace(String sentence){

  if(sentence.isEmpty()) return sentence;

  if(sentence.charAt(0) == ' ')

     return '*' + replace(sentence.substring(1,sentence.length()));

  else

     return sentence.charAt(0) +            replace(sentence.substring(1,sentence.length()));

3 0
2 years ago
Other questions:
  • Which of the following are recommended techniques for protecting computer files and data? Check all of the boxes that apply.
    15·2 answers
  • Which term describes a process by which malicious code can enter from a non-secure network, and make a hairpin, or sharp turn, a
    6·1 answer
  • Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB (in order), how would the first-fit, best-fit,
    11·1 answer
  • Axel is finally documenting his work. What could he be writing?
    12·1 answer
  • Collaboration online increases students' motivation by
    5·2 answers
  • Why is accessing a disk block expensive? discuss the time components involved in accessing a disk block. (?
    9·1 answer
  • Consider two vectors that are NOT sorted, each containing n comparable items. How long would it take to display all items (in an
    8·1 answer
  • In which of the security mechanism does the file containing data of the users/user groups have inbuilt security?
    6·1 answer
  • Assume that the variables v, w, x, y, and z are stored in memory locations 200, 201, 202, 203, and 204, respectively.
    6·1 answer
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!