Skip to content

Commit 4916a8c

Browse files
committed
补 Cylinder.cs文件
1 parent 4f79ca5 commit 4916a8c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace ToolGood.Algorithm.Test
7+
{
8+
//定义圆柱信息
9+
public class Cylinder : AlgorithmEngine
10+
{
11+
private int _radius;
12+
private int _height;
13+
public Cylinder(int radius, int height)
14+
{
15+
_radius = radius;
16+
_height = height;
17+
}
18+
19+
protected override Operand GetParameter(Operand curOpd)
20+
{
21+
if (curOpd.Parameter == "[半径]") {
22+
return new Operand(OperandType.NUMBER, _radius);
23+
}
24+
if (curOpd.Parameter == "[直径]") {
25+
return new Operand(OperandType.NUMBER, _radius * 2);
26+
}
27+
if (curOpd.Parameter == "[高]") {
28+
return new Operand(OperandType.NUMBER, _height);
29+
}
30+
return base.GetParameter(curOpd);
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)