-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCouponCodeValidator3606.java
More file actions
41 lines (34 loc) · 1.11 KB
/
CouponCodeValidator3606.java
File metadata and controls
41 lines (34 loc) · 1.11 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
import java.util.*;
public class CouponCodeValidator3606 {
private int var = 0;
public boolean check(String code) {
for (int i = 0; i < code.length(); i++) {
char c = code.charAt(i);
if (!Character.isLetterOrDigit(c) && c != '_') {
return false;
}
}
return true;
}
public boolean checkBusiness(String business) {
if (!business.equals("electronics") && !business.equals("grocery") && !business.equals("pharmacy")
&& !business.equals("restaurant")) {
return false;
}
return true;
}
// public List<String> validateCoupons(String[] code, String[] businessLine,
// boolean[] isActive) {
// }
private void changeVar(int chg) {
this.var = chg;
}
public static void main(String[] args) {
CouponCodeValidator3606 c = new CouponCodeValidator3606();
CouponCodeValidator3606 c1 = new CouponCodeValidator3606();
System.out.println(c.var);
c.changeVar(2);
System.out.println(c.var);
System.out.println(c1.var);
}
}