why the bmi is 0 eventhough i already set the value?
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
why the bmi is 0 eventhough i already set the value?
![* C:\Users\huawei\Desktop\CPM213\LEARN4.cpp - Dev-C++ 5.11
O X
File Edit Search View Project Execute Tools AStyle Window Help
TDM-GCC 4.9.2 64-bit Release
(globals)
Project Classes Debug
[*] LEARN4.cpp
4
float cal_BMI(float,float); //declare universal
class bodyBMI
5
6
private:
float BMI;
float weight;
float height;l
8
9
10
11
public:
void calBMI();
void displayBMI();
void setValue(float w, float h);
12
13
14
15
16
float getweight()
{
17
return weight; }
float getHeight()
{
18
19
return height;}
bodyBMI () //constructor
{
20
BMI=weight=height=@;
bodyBMI () //destructor
{
22
}
23
24
BMI=weight=height=0;
}
}3
void bodyBMI::calBMI()
{
25
26
BMI=weight/(height*height); }
void bodyBMI::displayBMI()
{
27
28
cout <« "Your BMI is :" « BMI << endl; }
void bodyBMI::setValue (float h, float w)
29
30
31 E {
height=h;
weight=w;
}
int main()
36 E {
32
33
34
35
37
bodyBMI anis, farah; //object
38
anis.setvalue(67,1.68);
farah.setValue(41,1.58);
39
40
41
anis.calBMI();
farah.displayBMI();
anis.calBMI();
farah.displayBMI();
}
42
43
44
45
46
I IL-J..DNT -L.
d-- ---
Line: 11
Col: 18
Sel: 0
Lines: 54
Length: 1135
Insert
Done parsing in 0.016 seconds
10:46 AM
IMI
12/12/2021
O Type here to search
DEV
26°C Mostly cloudy
E O 4») O ENG
10](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fec84e97f-6283-4e56-a301-8d740ee431d2%2F9b59a136-02f2-47de-93c0-3fee6a6ecfac%2Fsrkvvg_processed.png&w=3840&q=75)
Transcribed Image Text:* C:\Users\huawei\Desktop\CPM213\LEARN4.cpp - Dev-C++ 5.11
O X
File Edit Search View Project Execute Tools AStyle Window Help
TDM-GCC 4.9.2 64-bit Release
(globals)
Project Classes Debug
[*] LEARN4.cpp
4
float cal_BMI(float,float); //declare universal
class bodyBMI
5
6
private:
float BMI;
float weight;
float height;l
8
9
10
11
public:
void calBMI();
void displayBMI();
void setValue(float w, float h);
12
13
14
15
16
float getweight()
{
17
return weight; }
float getHeight()
{
18
19
return height;}
bodyBMI () //constructor
{
20
BMI=weight=height=@;
bodyBMI () //destructor
{
22
}
23
24
BMI=weight=height=0;
}
}3
void bodyBMI::calBMI()
{
25
26
BMI=weight/(height*height); }
void bodyBMI::displayBMI()
{
27
28
cout <« "Your BMI is :" « BMI << endl; }
void bodyBMI::setValue (float h, float w)
29
30
31 E {
height=h;
weight=w;
}
int main()
36 E {
32
33
34
35
37
bodyBMI anis, farah; //object
38
anis.setvalue(67,1.68);
farah.setValue(41,1.58);
39
40
41
anis.calBMI();
farah.displayBMI();
anis.calBMI();
farah.displayBMI();
}
42
43
44
45
46
I IL-J..DNT -L.
d-- ---
Line: 11
Col: 18
Sel: 0
Lines: 54
Length: 1135
Insert
Done parsing in 0.016 seconds
10:46 AM
IMI
12/12/2021
O Type here to search
DEV
26°C Mostly cloudy
E O 4») O ENG
10
![* C:\Users\huawei\Desktop\CPM213\LEARN4.cpp - [Executing] - Dev-C++ 5.11
File
I C:\Users\huawei\Desktop\CPM213\LEARN4.exe
Your BMI is :0
Your BMI is :0
Proje
Process exited after 0.08473 seconds with return value 0
Press any key to continue .
height=h;
weight=w;
}
int main()
36 B {
32
35
37
bodyBMI anis,farah; //object
38
anis.setvalue(67,1.68);
farah.setValue(41,1.58);
39
40
41
anis.calBMI();
farah.displayBMI();
anis.calBMI();
farah.displayBMI();
}
42
43
44
45
46
I IL-J..DNT -L.
d-- ---
Line: 11
Col: 18
Sel: 0
Lines: 54
Length: 1135
Insert
Done parsing in 0.031 seconds
10:46 AM
IMI
12/12/2021
O Type here to search
DEV
26°C Mostly cloudy
E O 4») O ENG
10](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fec84e97f-6283-4e56-a301-8d740ee431d2%2F9b59a136-02f2-47de-93c0-3fee6a6ecfac%2F9srgetr_processed.png&w=3840&q=75)
Transcribed Image Text:* C:\Users\huawei\Desktop\CPM213\LEARN4.cpp - [Executing] - Dev-C++ 5.11
File
I C:\Users\huawei\Desktop\CPM213\LEARN4.exe
Your BMI is :0
Your BMI is :0
Proje
Process exited after 0.08473 seconds with return value 0
Press any key to continue .
height=h;
weight=w;
}
int main()
36 B {
32
35
37
bodyBMI anis,farah; //object
38
anis.setvalue(67,1.68);
farah.setValue(41,1.58);
39
40
41
anis.calBMI();
farah.displayBMI();
anis.calBMI();
farah.displayBMI();
}
42
43
44
45
46
I IL-J..DNT -L.
d-- ---
Line: 11
Col: 18
Sel: 0
Lines: 54
Length: 1135
Insert
Done parsing in 0.031 seconds
10:46 AM
IMI
12/12/2021
O Type here to search
DEV
26°C Mostly cloudy
E O 4») O ENG
10
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education