-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOffers.java
41 lines (33 loc) · 1.22 KB
/
Offers.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
package RestaurantManagementSystem;
import java.util.Random;
public class Offers {
Random rand = new Random();
// --------------------------- For Premium User
int Voucher() {
int value = rand.nextInt(10) + 1;
System.out.println("You get " + value + "% OFF this time as a premium user!");
return value;
}
// OverLoading --------------- For general User
int Voucher(int total_puchase, int total_money) {
if (total_puchase > 10 && total_money > 500) {
int value = rand.nextInt(20) + 10;
System.out.println("You get " + value + "% OFF this time!");
return value;
}
return 0;
}
// OverLoading ---------------- For premium User
int Voucher(int total_puchase) {
if (total_puchase > 10 && total_puchase <= 20) {
int value = rand.nextInt(15) + 15;
System.out.println("You get " + value + "% OFF this time as a premium user!");
return value;
} else if (total_puchase > 20) {
int value = rand.nextInt(30) + 20;
System.out.println("You get " + value + "% OFF this time as a premium user!");
return value;
}
return 0;
}
}