Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *********************************MAIN.CPP**********************************
- #include <iostream>
- #include <string>
- #include "BMI.h"
- using namespace std;
- int main() {
- string name;
- int height;
- double weight;
- cout << "Enter your name: ";
- cin >> name;
- cout << "Enter your height (in inches): ";
- cin >> height;
- cout << "Enter your weight (in pounds): ";
- cin >> weight;
- BMI Student_1(name, height, weight);
- cout << end1 << "Patient Name: " << Student_1.getName() << end1 <<
- "Height: " << Student_1.getHeight() << end1 <<
- "Weight: " << Student_1.getWeight() << end1;
- return 0;
- }
- ******************************BMI.CPP***********************************
- //Function Definitions
- #include "BMI.h"
- BMI::BMI() {
- newHeight = 0;
- newWeight = 0.0;
- }
- BMI::BMI(string name, int height, double weight) {
- newName = name;
- newHeight = height;
- newWeight = weight;
- }
- BMI::~BMI() {
- }
- string BMI::getName() const {
- return newName;
- }
- int BMI::getHeight() const {
- return newHeight;
- }
- double BMI::getWeight() const {
- return newWeight;
- }
- *******************************BMI.H*******************************
- // Header ==> Function Declarations
- #include <iostream>
- #include <string>
- using namespace std;
- #ifndef BMI_H
- #define BMI_H
- class BMI {
- public:
- //Defualt Constructor
- BMI();
- //Overload Constructor
- BMI(string, int, double);
- //Destructor
- ~BMI();
- //Accessor Functions
- string getName() const;
- // getName - returns name of paitent
- int getHeight() const;
- //getHeight - returns height of paitent
- double getWeight() const;
- //getWeight returns weight of paitent
- private:
- //Member Variables
- string newName;
- int newHeight;
- double newWeight;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement