SlideShare a Scribd company logo
1 of 4
Download to read offline
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class BMI
{
double weight;
double height;
public BMI() //default constructor
{
weight = 0;
height = 0;
}
public BMI(double wt,double ht) //parameterized constructor
{
weight = wt;
height = ht;
}
public void input() //function to input height and weight
{
Console.WriteLine("Enter weight in kilograms");
weight = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter height in metres");
height = Convert.ToDouble(Console.ReadLine());
}
public void BMIstatus() //function to calculate BMI and display status of person
{
double bmi;
bmi = weight / (height * height);
if (bmi<18.5)
Console.WriteLine("Person is Underweight");
else if(bmi>18.5 && bmi<24.9)
Console.WriteLine("Person is normal");
else if(bmi>25 && bmi<29.9)
Console.WriteLine("Person is Overweight");
else if(bmi>=30)
Console.WriteLine("Person is Obese");
}
}
class Program
{
static void Main(string[] args)
{
BMI person1=new BMI();
person1.input(); //call functions
person1.BMIstatus();
Console.ReadLine();
}
}
}
output:
Enter weight in kilograms 70
Enter height in metres 1.57
Person is Overweight
Solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class BMI
{
double weight;
double height;
public BMI() //default constructor
{
weight = 0;
height = 0;
}
public BMI(double wt,double ht) //parameterized constructor
{
weight = wt;
height = ht;
}
public void input() //function to input height and weight
{
Console.WriteLine("Enter weight in kilograms");
weight = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter height in metres");
height = Convert.ToDouble(Console.ReadLine());
}
public void BMIstatus() //function to calculate BMI and display status of person
{
double bmi;
bmi = weight / (height * height);
if (bmi<18.5)
Console.WriteLine("Person is Underweight");
else if(bmi>18.5 && bmi<24.9)
Console.WriteLine("Person is normal");
else if(bmi>25 && bmi<29.9)
Console.WriteLine("Person is Overweight");
else if(bmi>=30)
Console.WriteLine("Person is Obese");
}
}
class Program
{
static void Main(string[] args)
{
BMI person1=new BMI();
person1.input(); //call functions
person1.BMIstatus();
Console.ReadLine();
}
}
}
output:
Enter weight in kilograms 70
Enter height in metres 1.57
Person is Overweight

More Related Content

More from DEEPAKSONI562

Toxicants may move across biological membranes by all the following .pdf
Toxicants may move across biological membranes by all the following .pdfToxicants may move across biological membranes by all the following .pdf
Toxicants may move across biological membranes by all the following .pdfDEEPAKSONI562
 
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdf
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdftime is 18.2yearsdetailed answer i will submit nowSolutionti.pdf
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdfDEEPAKSONI562
 
This is the code for the above 5 public class Input extends JFram.pdf
This is the code for the above 5 public class Input extends JFram.pdfThis is the code for the above 5 public class Input extends JFram.pdf
This is the code for the above 5 public class Input extends JFram.pdfDEEPAKSONI562
 
Team public class Team {    private String teamId;    priva.pdf
Team public class Team {    private String teamId;    priva.pdfTeam public class Team {    private String teamId;    priva.pdf
Team public class Team {    private String teamId;    priva.pdfDEEPAKSONI562
 
PollinationFertilization1.     Pollination is the transfer of po.pdf
PollinationFertilization1.     Pollination is the transfer of po.pdfPollinationFertilization1.     Pollination is the transfer of po.pdf
PollinationFertilization1.     Pollination is the transfer of po.pdfDEEPAKSONI562
 
Patient.java package A9.toStudents; public class Patient imple.pdf
Patient.java package A9.toStudents; public class Patient imple.pdfPatient.java package A9.toStudents; public class Patient imple.pdf
Patient.java package A9.toStudents; public class Patient imple.pdfDEEPAKSONI562
 
Non financial performance indicators of United Utilities Group PLC. .pdf
Non financial performance indicators of United Utilities Group PLC. .pdfNon financial performance indicators of United Utilities Group PLC. .pdf
Non financial performance indicators of United Utilities Group PLC. .pdfDEEPAKSONI562
 
C) III is correct note the configuration keep un.pdf
                     C) III is correct note the configuration keep un.pdf                     C) III is correct note the configuration keep un.pdf
C) III is correct note the configuration keep un.pdfDEEPAKSONI562
 
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdf
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdfLHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdf
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdfDEEPAKSONI562
 
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdf
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdfimport com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdf
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdfDEEPAKSONI562
 
intervalSolutioninterval.pdf
intervalSolutioninterval.pdfintervalSolutioninterval.pdf
intervalSolutioninterval.pdfDEEPAKSONI562
 
In2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdfIn2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdfDEEPAKSONI562
 
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdf
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdfFeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdf
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdfDEEPAKSONI562
 
D the polar covalent bond within methanol cannot form hydrogen bond .pdf
D the polar covalent bond within methanol cannot form hydrogen bond .pdfD the polar covalent bond within methanol cannot form hydrogen bond .pdf
D the polar covalent bond within methanol cannot form hydrogen bond .pdfDEEPAKSONI562
 
Conflict theory asserts that social problems occur when dominant gro.pdf
Conflict theory asserts that social problems occur when dominant gro.pdfConflict theory asserts that social problems occur when dominant gro.pdf
Conflict theory asserts that social problems occur when dominant gro.pdfDEEPAKSONI562
 
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdf
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdfa) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdf
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdfDEEPAKSONI562
 
A. An Intranet is a private organization’s network, which can be com.pdf
A. An Intranet is a private organization’s network, which can be com.pdfA. An Intranet is a private organization’s network, which can be com.pdf
A. An Intranet is a private organization’s network, which can be com.pdfDEEPAKSONI562
 
3 5 x =Solution3 5 x =.pdf
3 5 x =Solution3 5 x =.pdf3 5 x =Solution3 5 x =.pdf
3 5 x =Solution3 5 x =.pdfDEEPAKSONI562
 

More from DEEPAKSONI562 (18)

Toxicants may move across biological membranes by all the following .pdf
Toxicants may move across biological membranes by all the following .pdfToxicants may move across biological membranes by all the following .pdf
Toxicants may move across biological membranes by all the following .pdf
 
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdf
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdftime is 18.2yearsdetailed answer i will submit nowSolutionti.pdf
time is 18.2yearsdetailed answer i will submit nowSolutionti.pdf
 
This is the code for the above 5 public class Input extends JFram.pdf
This is the code for the above 5 public class Input extends JFram.pdfThis is the code for the above 5 public class Input extends JFram.pdf
This is the code for the above 5 public class Input extends JFram.pdf
 
Team public class Team {    private String teamId;    priva.pdf
Team public class Team {    private String teamId;    priva.pdfTeam public class Team {    private String teamId;    priva.pdf
Team public class Team {    private String teamId;    priva.pdf
 
PollinationFertilization1.     Pollination is the transfer of po.pdf
PollinationFertilization1.     Pollination is the transfer of po.pdfPollinationFertilization1.     Pollination is the transfer of po.pdf
PollinationFertilization1.     Pollination is the transfer of po.pdf
 
Patient.java package A9.toStudents; public class Patient imple.pdf
Patient.java package A9.toStudents; public class Patient imple.pdfPatient.java package A9.toStudents; public class Patient imple.pdf
Patient.java package A9.toStudents; public class Patient imple.pdf
 
Non financial performance indicators of United Utilities Group PLC. .pdf
Non financial performance indicators of United Utilities Group PLC. .pdfNon financial performance indicators of United Utilities Group PLC. .pdf
Non financial performance indicators of United Utilities Group PLC. .pdf
 
C) III is correct note the configuration keep un.pdf
                     C) III is correct note the configuration keep un.pdf                     C) III is correct note the configuration keep un.pdf
C) III is correct note the configuration keep un.pdf
 
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdf
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdfLHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdf
LHS =2y+1RHS=-(-2y-1)         =2y+1LHS =RHSy=all the real nu.pdf
 
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdf
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdfimport com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdf
import com.rogue.roguer.command.CommandHandler; import com.rogue.r.pdf
 
intervalSolutioninterval.pdf
intervalSolutioninterval.pdfintervalSolutioninterval.pdf
intervalSolutioninterval.pdf
 
In2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdfIn2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdf
 
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdf
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdfFeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdf
FeCO3 is an ionic compound, composed of the Fe(II)2+ ion and the CO3.pdf
 
D the polar covalent bond within methanol cannot form hydrogen bond .pdf
D the polar covalent bond within methanol cannot form hydrogen bond .pdfD the polar covalent bond within methanol cannot form hydrogen bond .pdf
D the polar covalent bond within methanol cannot form hydrogen bond .pdf
 
Conflict theory asserts that social problems occur when dominant gro.pdf
Conflict theory asserts that social problems occur when dominant gro.pdfConflict theory asserts that social problems occur when dominant gro.pdf
Conflict theory asserts that social problems occur when dominant gro.pdf
 
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdf
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdfa) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdf
a) units of capacitance if Farads (F)b) unit of Inductance is Henr.pdf
 
A. An Intranet is a private organization’s network, which can be com.pdf
A. An Intranet is a private organization’s network, which can be com.pdfA. An Intranet is a private organization’s network, which can be com.pdf
A. An Intranet is a private organization’s network, which can be com.pdf
 
3 5 x =Solution3 5 x =.pdf
3 5 x =Solution3 5 x =.pdf3 5 x =Solution3 5 x =.pdf
3 5 x =Solution3 5 x =.pdf
 

Recently uploaded

Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 

Recently uploaded (20)

Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 

using System; using System.Collections.Generic; using System.Lin.pdf

  • 1. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class BMI { double weight; double height; public BMI() //default constructor { weight = 0; height = 0; } public BMI(double wt,double ht) //parameterized constructor { weight = wt; height = ht; } public void input() //function to input height and weight { Console.WriteLine("Enter weight in kilograms"); weight = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter height in metres"); height = Convert.ToDouble(Console.ReadLine()); } public void BMIstatus() //function to calculate BMI and display status of person { double bmi; bmi = weight / (height * height); if (bmi<18.5) Console.WriteLine("Person is Underweight");
  • 2. else if(bmi>18.5 && bmi<24.9) Console.WriteLine("Person is normal"); else if(bmi>25 && bmi<29.9) Console.WriteLine("Person is Overweight"); else if(bmi>=30) Console.WriteLine("Person is Obese"); } } class Program { static void Main(string[] args) { BMI person1=new BMI(); person1.input(); //call functions person1.BMIstatus(); Console.ReadLine(); } } } output: Enter weight in kilograms 70 Enter height in metres 1.57 Person is Overweight Solution using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class BMI { double weight; double height;
  • 3. public BMI() //default constructor { weight = 0; height = 0; } public BMI(double wt,double ht) //parameterized constructor { weight = wt; height = ht; } public void input() //function to input height and weight { Console.WriteLine("Enter weight in kilograms"); weight = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter height in metres"); height = Convert.ToDouble(Console.ReadLine()); } public void BMIstatus() //function to calculate BMI and display status of person { double bmi; bmi = weight / (height * height); if (bmi<18.5) Console.WriteLine("Person is Underweight"); else if(bmi>18.5 && bmi<24.9) Console.WriteLine("Person is normal"); else if(bmi>25 && bmi<29.9) Console.WriteLine("Person is Overweight"); else if(bmi>=30) Console.WriteLine("Person is Obese"); } } class Program { static void Main(string[] args)
  • 4. { BMI person1=new BMI(); person1.input(); //call functions person1.BMIstatus(); Console.ReadLine(); } } } output: Enter weight in kilograms 70 Enter height in metres 1.57 Person is Overweight