-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScottKinneyLab7Circle.cpp
69 lines (57 loc) · 1.55 KB
/
ScottKinneyLab7Circle.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// FILE Circle Implementation File (member function definitions)
/**
* Program name: ScottKinneyLab7Circle.cpp
* Discussion : Lab 7 Exercise 1
* Written by: Scott Kinney
* Date:
*/
#include <iostream>
using namespace std;
#include "ScottKinneyLab7Circle.h"
#include "ScottKinneyLab7Point.h"
#include "ScottKinneyLab7Fraction.h"
#include "ScottKinneyLab7Shape.h"
FractionScottK const PI(157/50);
void CircleScottK::print(ostream &os) {
os << "Circle:\nCenter: " << center << " Radius: " << radius <<
" Area: " << getArea() << endl;
}
FractionScottK CircleScottK::getR(void) const {
return radius;
}
FractionScottK CircleScottK::getArea(void) const {
return FractionScottK(PI * (radius * radius));
}
FractionScottK CircleScottK::getVol(void) const {
return 0;
}
ostream& operator<<(ostream &os, CircleScottK &circle) {
circle.print(os);
return os;
}
istream& operator>>(istream &is, CircleScottK &circle) {
is >> circle.center >> circle.radius;
return is;
}
CircleScottK::CircleScottK() {
// default constructor
}
CircleScottK::CircleScottK(PointScottK &c, FractionScottK &r)
: center(c), radius(r) {
}
CircleScottK::CircleScottK(const CircleScottK &old) {
//copy constructor
center = old.center;
radius = old.radius;
}
CircleScottK::~CircleScottK() {
}
CircleScottK& CircleScottK::operator=(const CircleScottK &arg) {
center = arg.center;
radius = arg.radius;
return *this;
}
void CircleScottK::update(PointScottK &c, FractionScottK &r) {
center = c;
radius = r;
}