-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shape.cs
47 lines (41 loc) · 1.09 KB
/
Shape.cs
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
using System;
public class Shape
{
private string Name;
private string ValueA;
private string ValueB;
private string Calculation;
public Shape (string Name, string ValueA, string ValueB, string Calculation){
this.Name = Name;
this.ValueA = ValueA;
this.ValueB = ValueB;
this.Calculation = Calculation;
}
public string getName() {
return Name;
}
public string getValueA() {
return ValueA;
}
public string getValueB() {
return ValueB;
}
public string getCalculation() {
return Calculation;
}
public double calculateResult(double ShapeValueA, double ShapeValueB) {
double result = 0;
switch (getName()) {
case "rechthoek":
result = ShapeValueA * ShapeValueB;
break;
case "driehoek":
result = (ShapeValueA * ShapeValueB) / 2;
break;
case "cirkel":
result = ShapeValueA * ShapeValueA * Math.PI;
break;
}
return result;
}
}