-
Notifications
You must be signed in to change notification settings - Fork 0
/
Premium.java
82 lines (70 loc) · 1.87 KB
/
Premium.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.MRS;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.Scanner;
public class Premium extends Mood {
public void explorepremium() {
ArrayList<String> ar = new ArrayList<>();
ar.add("✅ Ad-Free Experience");
ar.add("✅ High-Quality Audio Streaming");
ar.add("✅ Offline Listening");
ar.add("✅ Custom Playlists Creation");
ar.add("✅ Early Access to New Features");
ar.add("");
for (Object obj : ar) {
System.out.println(obj);
}
purchase();
}
public void purchase() {
Scanner sc = new Scanner(System.in);
System.out.println("Select a method to pay");
System.out.println("1 --> UPI");
System.out.println("2 --> Debit / Credit Card");
System.out.println("3 --> Home Page");
try {
int input = sc.nextInt();
switch (input) {
case 1:
upi();
break;
case 2:
card();
break;
case 3:
MoodInput();
break;
}
} catch (InputMismatchException ime) {
System.out.println("Select appropriate payment method");
purchase();
}
}
public void upi() {
String reset = "\u001B[0m";
String blue = "\u001B[34m";
Scanner sc = new Scanner(System.in);
System.out.println("Enter your upi id");
String id = sc.nextLine();
if (id.endsWith("@upi")) {
String transactionId = "";
Random r = new Random();
while (transactionId.length() < 6) {
int n = r.nextInt(123);
if (n >= 48 && n <= 57) {
transactionId = transactionId + n;
}
}
System.out.println("Click on the link to make your payment");
System.out.println(blue + "upi://pay?pa=" + id + "&tid=" + transactionId + reset);
} else {
System.err.println("Enter valid id");
upi();
}
}
public void card() {
System.out.println("Stay tuned we are working on this.");
purchase();
}
}