File tree Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .io .BufferedReader ;
2
+ import java .io .IOException ;
3
+ import java .io .InputStreamReader ;
4
+
5
+ //Complete the classes below
6
+ class Flower {
7
+ public String whatsYourName () {
8
+ return "I have many names and types." ;
9
+ }
10
+ }
11
+
12
+ class Jasmine extends Flower {
13
+ public String whatsYourName () {
14
+ return "Jasmine" ;
15
+ }
16
+ }
17
+
18
+ class Lily extends Flower {
19
+ public String whatsYourName () {
20
+ return "Lily" ;
21
+ }
22
+ }
23
+
24
+ class Region {
25
+ public Flower yourNationalFlower () {
26
+ return new Flower ();
27
+ }
28
+ }
29
+
30
+ class WestBengal extends Region {
31
+ public Flower yourNationalFlower () {
32
+ return new Jasmine ();
33
+ }
34
+ }
35
+
36
+ class AndhraPradesh extends Region {
37
+ public Flower yourNationalFlower () {
38
+ return new Lily ();
39
+ }
40
+ }
41
+
42
+ public class Solution {
43
+ public static void main (String [] args ) throws IOException {
44
+ BufferedReader reader = new BufferedReader (new InputStreamReader (System .in ));
45
+ String s = reader .readLine ().trim ();
46
+ Region region = null ;
47
+ switch (s ) {
48
+ case "WestBengal" :
49
+ region = new WestBengal ();
50
+ break ;
51
+ case "AndhraPradesh" :
52
+ region = new AndhraPradesh ();
53
+ break ;
54
+ }
55
+ Flower flower = region .yourNationalFlower ();
56
+ System .out .println (flower .whatsYourName ());
57
+ }
58
+ }
Original file line number Diff line number Diff line change
1
+ import java .io .*;
2
+ import java .util .*;
3
+ import java .security .*;
4
+ import java .math .BigInteger ;
5
+
6
+ public class Solution {
7
+
8
+ public static void main (String [] args ) throws Exception {
9
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10
+
11
+ MessageDigest md5 = MessageDigest .getInstance ("MD5" );
12
+
13
+ md5 .update (br .readLine ().getBytes ());
14
+ byte [] digest = md5 .digest ();
15
+
16
+ for (byte b : digest ) {
17
+ System .out .printf ("%02x" , b );
18
+ }
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ import java .io .*;
2
+ import java .util .*;
3
+ import java .security .*;
4
+ import java .math .BigInteger ;
5
+
6
+ public class Solution {
7
+
8
+ public static void main (String [] args ) throws Exception {
9
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10
+
11
+ MessageDigest sha = MessageDigest .getInstance ("SHA-256" );
12
+
13
+ sha .update (br .readLine ().getBytes ());
14
+ byte [] digest = sha .digest ();
15
+
16
+ for (byte b : digest ) {
17
+ System .out .printf ("%02x" , b );
18
+ }
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments