-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHotelBillingSystem.java
More file actions
63 lines (48 loc) · 1.91 KB
/
Copy pathHotelBillingSystem.java
File metadata and controls
63 lines (48 loc) · 1.91 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.io.*;
import java.util.Scanner;
public class HotelBillingSystem{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int choice, quantity;
double total = 0;
do {
System.out.println("\n===== HOTEL MENU =====");
System.out.println("1. Idli - ₹30");
System.out.println("2. Dosa - ₹50");
System.out.println("3. Poori - ₹40");
System.out.println("4. Coffee - ₹20");
System.out.println("5. Exit");
System.out.print("Enter your choice: ");
choice = sc.nextInt();
switch(choice) {
case 1:
System.out.print("Enter quantity: ");
quantity = sc.nextInt();
total = total + (30 * quantity);
break;
case 2:
System.out.print("Enter quantity: ");
quantity = sc.nextInt();
total = total + (50 * quantity);
break;
case 3:
System.out.print("Enter quantity: ");
quantity = sc.nextInt();
total = total + (40 * quantity);
break;
case 4:
System.out.print("Enter quantity: ");
quantity = sc.nextInt();
total = total + (20 * quantity);
break;
case 5:
System.out.println("\nThank You Visit Again!");
break;
default:
System.out.println("Invalid Choice");
}
} while(choice != 5);
System.out.println("\n===== FINAL BILL =====");
System.out.println("Total Amount = ₹" + total);
}
}