1 #ifndef PHARM_H
2 #define PHARM_H
3 #endif
4 #ifndef STRING_H
5 #define STRING_H
6 #include <string>
7 #endif
8 #ifndef EXCEPT_H
9 #define EXCEPT_H
10 #include <stdexcept>
11 #endif
12
13
14 using namespace std;
15
16 class DOSEING;
17 class Weight;
18 class Height;
19 class Zero : public runtime_error
20 {
21 public:
22 Zero()
23 :runtime_error("Zero in the Denominator - Serum Creatine like to be zero"){}
24 };
25
26
27 class Bugtrap: public runtime_error
28 {
29 public:
30 Bugtrap();
31 Bugtrap(const string);
32 Bugtrap(const string, const string, const string);
33 };
34
35
36
37
38 class Weight{
39 public:
40 Weight();
41 explicit Weight(float wgt);
42 Weight(float wgt, const string &unit);
43 Weight(const string &string);
44 Weight(const Weight&);
45 //doesn't work - assignment needs a single argument
46 //float operator=(const float wgt, const string &unit);
47
48 inline float wgt() const { return wgt_; };
49 float wgt(const float weight);
50 float wgt(const float weight, const string &unit);
51 float wgt(const string &descr);
52
53 float operator=(const char * h );
54 float operator=(const float w );
55 float operator=(const string &w );
56
57
58 protected:
59 float wgt_ ;
60 string unit_ ;
61 };
62
63
64
65 class Height{
66 public:
67 Height();
68 explicit Height(float hgt);
69 Height(float hgt, const string &unit);
70 Height(const string &fdesc);
71 Height(const Height&);
72 float operator=(const float h );
73 float operator=(const char * h );
74 float operator=(const string &h );
75 //doesn't work - assignment needs a single argument
76 //float operator=(const float hgt, const string &unit);
77
78 inline float hgt()const{ return hgt_; };
79 float hgt(const float fheight);
80 float hgt(const float fheight, const string &unit);
81 float hgt(const string &descr);
82 float hgt(const char * descr);
83
84
85
86
87 protected:
88 float hgt_ ;
89 string unit_ ;
90 };
91
92
93
94 class DOSEING{
95 public:
96 //constructors
97 DOSEING();
98 explicit DOSEING(string weight,string height,int age, char gen);
99 explicit DOSEING(float weight,string height,int age, char gen);
100 explicit DOSEING(string weight,float height,int age, char gen);
101 explicit DOSEING(float weight,float height,int age, char gen);
102
103 explicit DOSEING(string weight,string height,int age, char gen, float srcr );
104 explicit DOSEING(float weight,string height,int age, char gen, float srcr );
105 explicit DOSEING(string weight,float height,int age, char gen, float srcr );
106 explicit DOSEING(float weight,float height,int age, char gen, float srcr );
107
108 explicit DOSEING(string first, string last, string weight, string height,int age, char gen);
109 explicit DOSEING(string first, string last, float weight, string height,int age, char gen);
110 explicit DOSEING(string first, string last, string weight, float height,int age, char gen);
111 explicit DOSEING(string first, string last, float weight, float height,int age, char gen);
112
113 explicit DOSEING(string first, string last, string weight, string height, int age, char gen, float srcr);
114 explicit DOSEING(string first, string last, float weight, string height, int age, char gen, float srcr);
115 explicit DOSEING(string first, string last, string weight, float height, int age, char gen, float srcr);
116 explicit DOSEING(string first, string last, float weight, float height, int age, char gen, float srcr);
117
118 explicit DOSEING(string first, string last, string address, string weight, string height,int age, char gen, float srcr);
119 explicit DOSEING(string first, string last, string address, float weight, string height,int age, char gen, float srcr);
120 explicit DOSEING(string first, string last, string address, string weight, float height,int age, char gen, float srcr);
121 explicit DOSEING(string first, string last, string address, float weight, float height,int age, char gen, float srcr);
122
123 explicit DOSEING(string first, string last, string address, string weight, string height,int age, char gen );
124 explicit DOSEING(string first, string last, string address, float weight, string height,int age, char gen );
125 explicit DOSEING(string first, string last, string address, string weight, float height,int age, char gen );
126 explicit DOSEING(string first, string last, string address, float weight, float height,int age, char gen );
127
128 DOSEING( const DOSEING & rh);
129 //accessory methods
130 inline float weight()const{return weight_.wgt();};
131 inline float height()const{return height_.hgt();};
132 inline float srcr()const {return srcr_;};
133 inline int age()const{return age_;};
134 inline string& first(){return first_;};
135 inline string& last(){return last_;};
136 inline string& address(){return address_;};
137 inline char gender(){return gender_;};
138 inline float creatinecl(){return crcl_;};
139 //assignment
140 float weight(float x){return weight_.wgt(x);};
141 float weight(float x, string y){return weight_.wgt(x, y);};
142 float weight(string y){return weight_.wgt(y);};
143 float height(float x){return height_.hgt( x);};
144 float height(float x, string y){return height_.hgt( x, y);};
145 float height(string y){return height_.hgt( y);};
146 float srcr(float x) {return srcr_ = x ;};
147 int age(int x ){return age_ = x ;};
148 string& first(string y){return first_ = y;};
149 string& last(string y){return last_ = y;};
150 string& address(string y){return address_ = y;};
151 char gender(char y){return gender_ = y;};
152 float creatinecl(float crc ){return crcl();};
153
154
155 float crcl();
156
157
158 private:
159 Weight weight_;
160 Height height_;
161 float srcr_;
162 int age_;
163 char gender_;
164 string first_;
165 string last_;
166 string address_;
167 float crcl_;
168 float lbw_;
169 };
170
171
172
173
174
175
176
177
178
179