Create the class"interest"is defined with frnction and colculater the simple and compound interest
Answers
Answer:
it is easier to calculate simple interest than compound interest since simple interest is calculated only on the principal amount of a loan or deposit. The formula for simple interest is Interest = Principal x Rate x Time. To compute compound interest we use the formula: Amount = P*(1 + r/100)t.
Answer:
First you have to import the util package of Java so that you can use the Scanner class in this program which will help programmers to fetch input from users. Then define a class name sici. Inside the class define the main() function. All Java program needs one main() function from where it starts executing program.
Next declare a double type variable name pr, rate, t, sim and com. Also define an object name s of Scanner class using which the value will be fetched from input device. Then System.out.println() method will be used to display a message - "Enter the amount:". Then the statement pr=sc.nextDouble();