-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTriangle.java
More file actions
30 lines (25 loc) · 801 Bytes
/
Copy pathTriangle.java
File metadata and controls
30 lines (25 loc) · 801 Bytes
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
// This is a started code snipet for the notebook 03-Creating_a_Class.
// To complete it, follow the notebook step by step!
public class Triangle {
// create instance variables
double base;
double height;
double sideLenOne;
double sideLenTwo;
double sideLenThree;
// add constructor and inputs
public Triangle(double base, double height,
double sideLenOne, double sideLenTwo,
double sideLenThree) {
// access attributes
this.base = base;
this.height = height;
this.sideLenOne = sideLenOne;
this.sideLenTwo = sideLenTwo;
this.sideLenThree = sideLenThree;
}
// Add another method
public double findArea() {
return (this.base * this.height)/2 ;
}
}