Skip to content

Commit 0c19422

Browse files
authored
Create ScannerImplementation.java
1 parent 11cf1cb commit 0c19422

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.util.Scanner;
2+
/**
3+
* IO using scanner class
4+
*/
5+
class ScannerImplementation {
6+
7+
public static void main (String s[]){
8+
9+
double p=0.0,r=0.0,t=0.0,sin=0.0;
10+
/**
11+
* Scanner automatically detects the data type of the input no parse is required.
12+
* Create an object of scanner class
13+
*/
14+
Scanner sc = new Scanner(System.in);
15+
16+
System.out.print("\n enter principal amount");
17+
p= sc.nextDouble();
18+
System.out.print("\n enter rate");
19+
r =sc.nextDouble();
20+
System.out.print("\n enter time");
21+
t = sc.nextDouble();
22+
23+
sin = (p*r*t)/100;
24+
25+
System.out.print("\n the simple interest is "+ sin);
26+
27+
28+
29+
30+
}
31+
}

0 commit comments

Comments
 (0)