Computer Applications
Write a program in Java that uses 'input using initialisation' to calculate the Simple Interest and the Total Amount with the given values:
i. Principle Amount = Rs. 20000
ii. Rate = 8.9%
iii. Time = 3 years
Java
Input in Java
53 Likes
Answer
public class KboatInterest
{
public static void main(String args[]) {
int p = 20000;
double r = 8.9;
int t = 3;
double si = p * r * t / 100.0;
double amt = p + si;
System.out.println("Simple Interest = " + si);
System.out.println("Total Amount = " + amt);
}
}
Output
Answered By
25 Likes
Related Questions
A program has compiled successfully without any errors. Does this mean the program is error free? Explain.
Write a program in java to input the temperature in Fahrenheit, convert it into Celsius and display the value in the Terminal window. A sample output is displayed below:
Enter temperature in Fahrenheit 176 176.0 degree Fahrenheit = 80.0 degree Celsius
Explain the following terms, giving an example of each.
i. Syntax error
ii. Runtime error
iii. Logical error
Write a program in Java that accepts the seconds as input and converts them into the corresponding number of hours, minutes and seconds. A sample output is shown below:
Enter Total Seconds: 5000 1 Hour(s) 23 Minute(s) 20 Second(s)