-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path8.1 GST Adder.java
48 lines (33 loc) · 1.42 KB
/
8.1 GST Adder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Mr. Chunnilal is looking for a solution to calculate the price of products after applying the GST for his General Store. There are 3 slabs of GST for different products in his store i.e. 5.0%, 12.5 % and 18.25%. Chunnilal is expecting that the GST should be applied on the price of the product considering the Rupees part only (ignoring the paisa) and after adding the GST on the actual price, only the Rupees part should be displayed (ignoring the paisa part).
Example: If the price of the product is Rs. 115.5 and GST Rate is 12.5% then GST is calculated on Rs. 115 and it is Rs. 14.375. Total Price after GST should be Rs. 129.875. But displayed price after GST is 129 only.
Input Format
First line reads the price P (double) of the product
Second line reads the GST rate R (double) for the product
Constraints
price > 0
Output Format
prints the price of the product after GST (int)
Sample Input 0
115.5
12.5
Sample Output 0
129
Sample Input 1
55.25
5.0
Sample Output 1
58
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
double price = sc.nextDouble();
double gst = sc.nextDouble();
double result = price +(((int)price*(gst))/100);
System.out.print((int)result);
}
}