SlideShare a Scribd company logo
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 .pdf
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
intervalSolutioninterval.pdf
intervalSolutioninterval.pdfintervalSolutioninterval.pdf
intervalSolutioninterval.pdf
DEEPAKSONI562
 
In2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdfIn2O3SolutionIn2O3.pdf
In2O3SolutionIn2O3.pdf
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 
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
DEEPAKSONI562
 

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

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 

Recently uploaded (20)

Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 

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