We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b48e148 commit dc4a79bCopy full SHA for dc4a79b
design_patterns.txt
@@ -1 +1,47 @@
1
https://ideone.com/pReC4E
2
+import java.util.*;
3
+import java.io.*;
4
+
5
+interface Shape {
6
7
+ void takeInput();
8
+ void draw();
9
10
+}
11
12
+class Circle implements Shape {
13
14
+ private int c_x, c_y, r;
15
16
+ void takeInput(){
17
+ Scanner sc = new Scanner(System.in);
18
+ c_x = sc.nextInt(); c_y = sc.nextInt(); r = sc.nextInt();
19
+ }
20
21
+ void draw(){
22
+ System.out.println(this);
23
24
25
+ @Override
26
+ public toString(){
27
+ return "x : " + c_x + " y : " + c_y + " r : " + r;
28
29
30
31
32
+class Rectangle implements Shape{
33
34
+ private int w, h;
35
36
37
38
39
40
41
42
43
44
+ return "w : " + w + " h : " + h;
45
46
47
0 commit comments