Professional Documents
Culture Documents
Cse Assignnment-08
Cse Assignnment-08
WEEK-08
NAME:P.ANAGHAA THANMAYEE
REG.NO:22BCE7306
INPUT:
Write a method in java to calculate the amount payable if money has been lent on
simple interest. Principal or money lent = P, Rate of interest = R% per annum and
Time = T years. Then Simple Interest (SI) = (P x R x T)/ 100. Amount payable =
Principal + SI. P, R and T are given as input to the program.
Implement the above method using
this.principal = principal;
this.rate = rate;
this.time = time;
return amountPayable;
double rate = 5;
double time = 2;
}
OUTPUT:
INPUT:
Write a method in java to calculate the amount payable if money has been lent on
simple interest. Principal or money lent = P, Rate of interest = R% per annum and
Time = T years. Then Simple Interest (SI) = (P x R x T)/ 100. Amount payable =
Principal + SI. P, R and T are given as input to the program.
Implement the above method using
this.principal = principal;
this.rate = rate;
this.time = time;
class SimpleInterestCalculator {
}
}
return amountPayable;
OUTPUT:
INPUT:
Write a method in java to calculate the amount payable if money has been lent on
simple interest. Principal or money lent = P, Rate of interest = R% per annum and
Time = T years. Then Simple Interest (SI) = (P x R x T)/ 100. Amount payable =
Principal + SI. P, R and T are given as input to the program.
Implement the above method using
3.static nested inner class
public class SimpleInterest {
static class Calculator {
public static double calculateAmountPayable(double principal, double rate, double time) {
double si = (principal * rate * time) / 100;
double amountPayable = principal + si;
return amountPayable;
}
}
OUTPUT:
INPUT:
Write a method in java to calculate the amount payable if money has been lent on
simple interest. Principal or money lent = P, Rate of interest = R% per annum and
Time = T years. Then Simple Interest (SI) = (P x R x T)/ 100. Amount payable =
Principal + SI. P, R and T are given as input to the program.
Implement the above method using
import java.util.Scanner;
@Override
};
interface SimpleInterestCalculator {
OUTPUT: