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;
}