-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfixMe.java
More file actions
51 lines (50 loc) · 1.23 KB
/
fixMe.java
File metadata and controls
51 lines (50 loc) · 1.23 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
42
43
44
45
46
47
48
49
50
51
package myapplication;
import java.awt.*;
public class MyApplication {
static final String startStr="\n****start of the program****";
final String endStr="\n****end of the program****";
public void main(String []arg){
printMessage(startStr);
Square s=new Square(100);
System.out.println(s.computePerimeter());
System.out.println(s.computeSurface());
Point p1=new Point(10,10);
Point p2=new Point(10.1,10.2);
ColorPoint cp1=new ColorPoint(1,1);
ColorPoint cp2=new ColorPoint(1,1,new Color(12,34,56));
cp1=p1;
p1=cp1;
MyApplication myA=new MyApplication();
myA.printMessage(endStr);
myA.printMessage(myA.endStr);
}//main Method
private void printMessage(String str)
{
System.out.println(str);
}
////////////////////////////////
class Square {
public Square(int init_x){x=init_x;}
public int computeSurface(){return x**x;}
public int computePerimeter(){return 4*x;}
private int x;
}//square
}//myApplication
class Point{
public Point(int init_x,int init_y){
x=init_x;
y=init_y;
}
public void move(int init_x,int init_y){
x+=init_x;
y+=init_y;
}
protected int x,y;
}//point
class ColorPoint extends Point{
public ColorPoint(int init_x,int init_y){
super(init_x,init_y);
color=Color.Blue;
}
Color color;
}//ColorPoint