Answer:
/* interest = principal amount * rate*time
Total amount = principal + interest
*/
See a java program with a method that implements the solution in the explanation section
Step-by-step explanation:
public class num6 {
public static void main(String[] args) {
double capital = 5000;
int noYears = 1;
double intRate = 0.02;
System.out.println("Interest is "+simpleInterest(capital,noYears,intRate));
double totalAmount = capital + simpleInterest(capital,noYears,intRate);
System.out.println("Total Amount is "+totalAmount);
}
public static double simpleInterest(double capital, int timeInYears, double rateInPercentage){
double interest = capital*timeInYears*rateInPercentage;
return interest;
}
}