Advertisement
Guest User

Untitled

a guest
Dec 14th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. *********************************MAIN.CPP**********************************
  2.  
  3. #include <iostream>
  4. #include <string>
  5.  
  6. #include "BMI.h"
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.  
  12. string name;
  13. int height;
  14. double weight;
  15.  
  16. cout << "Enter your name: ";
  17. cin >> name;
  18. cout << "Enter your height (in inches): ";
  19. cin >> height;
  20. cout << "Enter your weight (in pounds): ";
  21. cin >> weight;
  22.  
  23. BMI Student_1(name, height, weight);
  24.  
  25. cout << end1 << "Patient Name: " << Student_1.getName() << end1 <<
  26. "Height: " << Student_1.getHeight() << end1 <<
  27. "Weight: " << Student_1.getWeight() << end1;
  28.  
  29. return 0;
  30. }
  31.  
  32.  
  33.  
  34. ******************************BMI.CPP***********************************
  35. //Function Definitions
  36.  
  37. #include "BMI.h"
  38.  
  39. BMI::BMI() {
  40. newHeight = 0;
  41. newWeight = 0.0;
  42. }
  43.  
  44. BMI::BMI(string name, int height, double weight) {
  45. newName = name;
  46. newHeight = height;
  47. newWeight = weight;
  48. }
  49.  
  50. BMI::~BMI() {
  51.  
  52. }
  53.  
  54. string BMI::getName() const {
  55. return newName;
  56. }
  57.  
  58. int BMI::getHeight() const {
  59. return newHeight;
  60. }
  61.  
  62. double BMI::getWeight() const {
  63. return newWeight;
  64.  
  65. }
  66.  
  67.  
  68.  
  69. *******************************BMI.H*******************************
  70. // Header ==> Function Declarations
  71.  
  72. #include <iostream>
  73. #include <string>
  74.  
  75. using namespace std;
  76.  
  77. #ifndef BMI_H
  78. #define BMI_H
  79.  
  80. class BMI {
  81. public:
  82. //Defualt Constructor
  83. BMI();
  84.  
  85. //Overload Constructor
  86. BMI(string, int, double);
  87.  
  88. //Destructor
  89. ~BMI();
  90.  
  91. //Accessor Functions
  92. string getName() const;
  93. // getName - returns name of paitent
  94.  
  95. int getHeight() const;
  96. //getHeight - returns height of paitent
  97.  
  98. double getWeight() const;
  99. //getWeight returns weight of paitent
  100.  
  101.  
  102. private:
  103. //Member Variables
  104. string newName;
  105. int newHeight;
  106. double newWeight;
  107. };
  108.  
  109. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement