n/a
Circle.cpp@0:18f22caa11d8, 2016-03-22 (annotated)
- Committer:
- kch78
- Date:
- Tue Mar 22 09:30:01 2016 +0000
- Revision:
- 0:18f22caa11d8
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kch78 | 0:18f22caa11d8 | 1 | #include "Circle.h" |
kch78 | 0:18f22caa11d8 | 2 | #include "Shape.h" |
kch78 | 0:18f22caa11d8 | 3 | #include "mbed.h" |
kch78 | 0:18f22caa11d8 | 4 | #include <string> |
kch78 | 0:18f22caa11d8 | 5 | |
kch78 | 0:18f22caa11d8 | 6 | Circle::Circle(float radius) |
kch78 | 0:18f22caa11d8 | 7 | { |
kch78 | 0:18f22caa11d8 | 8 | this->width = this->height = radius * 2.0; |
kch78 | 0:18f22caa11d8 | 9 | } |
kch78 | 0:18f22caa11d8 | 10 | |
kch78 | 0:18f22caa11d8 | 11 | float Circle::getArea() |
kch78 | 0:18f22caa11d8 | 12 | { |
kch78 | 0:18f22caa11d8 | 13 | return width * width * 3.14159265 / 4.0; |
kch78 | 0:18f22caa11d8 | 14 | } |