-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBill.java
More file actions
27 lines (19 loc) · 801 Bytes
/
Bill.java
File metadata and controls
27 lines (19 loc) · 801 Bytes
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
import java.util.Scanner;
public class Bill {
public static void main(String[] args) {
try (Scanner bl = new Scanner(System.in)) {
System.out.print("Enter cost of Pencil: ");
float pencil = bl.nextFloat();
System.out.print("Enter cost of Pen: ");
float pen = bl.nextFloat();
System.out.print("Enter cost of Eraser: ");
float eraser = bl.nextFloat();
float total = pencil + pen + eraser;
float gst = total * 0.18f; // 18% GST
float finalBill = total + gst;
System.out.println("Total cost without GST: " + total);
System.out.println("GST (18%): " + gst);
System.out.println("Final Bill (including GST): " + finalBill);
}
}
}