Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
44 lines (31 loc) · 1018 Bytes

File metadata and controls

44 lines (31 loc) · 1018 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
public class Triangle9 extends TwoDShape9 {
private String styleString;
// A default constructor.
public Triangle9() {
super(); // Call superclass constructor.
styleString = "none";
}
// Constructor
Triangle9(String s, double w, double h){
super(w, h); // Use super() to call the various forms of the TwoDShape constructor.
width = w;
height = h;
styleString = s;
}
// One argument constructor.
Triangle9(double x){
super(x); // Use super() to construct the various forms of the TwoDShape constructor.
styleString = "filled";
}
// Construct an object from an object.
Triangle9(Triangle9 ob){
super(ob); // pass object to TwoDShape9 constructor, i.e., pass a Triangle9 reference to TwoDShape9's constructor.
styleString = ob.styleString;
}
double area() {
return getWidth() * getHeight() / 2;
}
void showStyle() {
System.out.println("Triangle is " + styleString);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.