Respuesta :
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;
}
In this exercise we have to use the knowledge in computational language in python to write the following code:
We have the code can be found in the attached image.
So in an easier way we have that the code is
a)amount = 5000
rate = 2
year = 1
interest = calculateInterest(amount, rate, year);
finalAmount = amount + interest
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
calculateInterest(amount, rate, year):
interest = (amount*rate*year)/100;
return interest
c)#include <iostream>
using namespace std;
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;
double interest = calculateInterest(amount, rate, year);
cout<<"Amount after 1 year: "<<(amount+interest)<<endl;
return 0;
}
double calculateInterest(double amount, double rate, int year){
return (amount*rate*year)/100.0;
}
See more about python at brainly.com/question/18502436


