Skip to content

Commit d269a60

Browse files
committed
feat: Add Ticket class to calculate total ticket price with GST and discount
Add a program that: - Calculates total price for adult and child tickets - Applies 18% GST to the total ticket price - Applies a 10% discount on the price after GST - Outputs the final payable amount - Demonstrates arithmetic operations and order of operations in Java.
1 parent dc816a6 commit d269a60

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
class Ticket {
22
public static void main(String[] args) {
3-
int a = 5, c = 3, at = 1000, ct = 500;
3+
int a = 5, c = 3,
4+
at = 1000, ct = 500;
5+
46
int tp = (a*at) + (c*ct);
7+
58
double gst = 0.18 * tp;
9+
610
double pbd = tp+gst;
11+
712
double dp = 0.1 * pbd;
13+
814
double fp = pbd - dp;
915

1016
System.out.println("Final Price is: "+fp);
1117
}
12-
}
18+
}

0 commit comments

Comments
 (0)