SlideShare a Scribd company logo
1 of 3
Download to read offline
P1.java
import java.util.Scanner;//keyboard inputting package
public class P1 {//main class
public static void main(String[] args) {//main method
Scanner input = new Scanner (System.in);
//User will input values
System.out.print("Enter your weght in pounds:");
int weight = input.nextInt();//keyboard inputting
//User will input values
System.out.print("Enter your feet and inches:");
int feet = input.nextInt();//keyboard inputting
int inches=input.nextInt();
int totalheightininches=0;
totalheightininches=(feet*12)+inches;//converting feet and inches into total inches
float bmi;
float constant=703f;
bmi = (float) (weight /Math.pow(totalheightininches,2))*constant;//bmi calculation
//Print out results on display
System.out.println("BMI is" + bmi);
if(bmi <18.5)
System.out.println("Underweight");
else if (bmi <25)
System.out.println("Normal");
else if (bmi < 30)
System.out.println("Overweight");
else
System.out.println("Obese");
}
}
output
Enter your weght in pounds:150
Enter your feet and inches:5 5
BMI is24.95858
Normal
Solution
P1.java
import java.util.Scanner;//keyboard inputting package
public class P1 {//main class
public static void main(String[] args) {//main method
Scanner input = new Scanner (System.in);
//User will input values
System.out.print("Enter your weght in pounds:");
int weight = input.nextInt();//keyboard inputting
//User will input values
System.out.print("Enter your feet and inches:");
int feet = input.nextInt();//keyboard inputting
int inches=input.nextInt();
int totalheightininches=0;
totalheightininches=(feet*12)+inches;//converting feet and inches into total inches
float bmi;
float constant=703f;
bmi = (float) (weight /Math.pow(totalheightininches,2))*constant;//bmi calculation
//Print out results on display
System.out.println("BMI is" + bmi);
if(bmi <18.5)
System.out.println("Underweight");
else if (bmi <25)
System.out.println("Normal");
else if (bmi < 30)
System.out.println("Overweight");
else
System.out.println("Obese");
}
}
output
Enter your weght in pounds:150
Enter your feet and inches:5 5
BMI is24.95858
Normal

More Related Content

Similar to P1.javaimport java.util.Scanner;keyboard inputting package pub.pdf

Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
arihantmum
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
optokunal1
 
I need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docxI need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docx
mckerliejonelle
 
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdfimport java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
KUNALHARCHANDANI1
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specifications
rajkumari873
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
Dillon Lee
 
import java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdfimport java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdf
apexelectronices01
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
anithareadymade
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
fathimafancy
 

Similar to P1.javaimport java.util.Scanner;keyboard inputting package pub.pdf (18)

Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdfWrite the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
Write the code above and the ones below in netbeans IDE 8.13. (Eli.pdf
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
I need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docxI need to create a data type that implement the following interface -.docx
I need to create a data type that implement the following interface -.docx
 
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdfimport java.util.Scanner;import java.text.DecimalFormat;import j.pdf
import java.util.Scanner;import java.text.DecimalFormat;import j.pdf
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specifications
 
Mamdani
MamdaniMamdani
Mamdani
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
 
import java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdfimport java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdf
 
Algoritmos sujei
Algoritmos sujeiAlgoritmos sujei
Algoritmos sujei
 
C#.net
C#.netC#.net
C#.net
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
import java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdfimport java.util.; public class DecimalToBinary { public stat.pdf
import java.util.; public class DecimalToBinary { public stat.pdf
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
Java file
Java fileJava file
Java file
 

More from aquacareser

1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
1) MODERN TIMES is a very well prepared movie that describes the mis.pdf1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
aquacareser
 
1. Identify five differences between DNA replication and gene transc.pdf
1. Identify five differences between DNA replication and gene transc.pdf1. Identify five differences between DNA replication and gene transc.pdf
1. Identify five differences between DNA replication and gene transc.pdf
aquacareser
 
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
aquacareser
 
this is my code to count the frequency of words in a text file#.pdf
 this is my code to count the frequency of words in a text file#.pdf this is my code to count the frequency of words in a text file#.pdf
this is my code to count the frequency of words in a text file#.pdf
aquacareser
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
aquacareser
 
Web sever environmentA Web server is a program that uses HTTP (Hy.pdf
Web sever environmentA Web server is a program that uses HTTP (Hy.pdfWeb sever environmentA Web server is a program that uses HTTP (Hy.pdf
Web sever environmentA Web server is a program that uses HTTP (Hy.pdf
aquacareser
 
We ca use HashSet data structure to remove duplicats from an array i.pdf
We ca use HashSet data structure to remove duplicats from an array i.pdfWe ca use HashSet data structure to remove duplicats from an array i.pdf
We ca use HashSet data structure to remove duplicats from an array i.pdf
aquacareser
 
The middle ear bones in mammals are derived from bones in the dentar.pdf
The middle ear bones in mammals are derived from bones in the dentar.pdfThe middle ear bones in mammals are derived from bones in the dentar.pdf
The middle ear bones in mammals are derived from bones in the dentar.pdf
aquacareser
 
There is an old saying “Do not put all eggs in one basket”WhyBe.pdf
There is an old saying “Do not put all eggs in one basket”WhyBe.pdfThere is an old saying “Do not put all eggs in one basket”WhyBe.pdf
There is an old saying “Do not put all eggs in one basket”WhyBe.pdf
aquacareser
 
The ER Model is focussed to be a description of real-world entities..pdf
The ER Model is focussed to be a description of real-world entities..pdfThe ER Model is focussed to be a description of real-world entities..pdf
The ER Model is focussed to be a description of real-world entities..pdf
aquacareser
 
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdfPlease find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
aquacareser
 
Question 1 answer is A Global trade allows wealthy countries to use .pdf
Question 1 answer is A Global trade allows wealthy countries to use .pdfQuestion 1 answer is A Global trade allows wealthy countries to use .pdf
Question 1 answer is A Global trade allows wealthy countries to use .pdf
aquacareser
 
Precipitation hardening, or age hardening, provides one of the most .pdf
Precipitation hardening, or age hardening, provides one of the most .pdfPrecipitation hardening, or age hardening, provides one of the most .pdf
Precipitation hardening, or age hardening, provides one of the most .pdf
aquacareser
 
Protists are beneficial to the ecosystem in generating oxygen as the.pdf
Protists are beneficial to the ecosystem in generating oxygen as the.pdfProtists are beneficial to the ecosystem in generating oxygen as the.pdf
Protists are beneficial to the ecosystem in generating oxygen as the.pdf
aquacareser
 
operating system linux,ubuntu,Mac#include iostream #include .pdf
operating system linux,ubuntu,Mac#include iostream #include .pdfoperating system linux,ubuntu,Mac#include iostream #include .pdf
operating system linux,ubuntu,Mac#include iostream #include .pdf
aquacareser
 
Network Protocol1) A Protocol is used for the communication betwe.pdf
Network Protocol1) A Protocol is used for the communication betwe.pdfNetwork Protocol1) A Protocol is used for the communication betwe.pdf
Network Protocol1) A Protocol is used for the communication betwe.pdf
aquacareser
 

More from aquacareser (20)

1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
1) MODERN TIMES is a very well prepared movie that describes the mis.pdf1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
1) MODERN TIMES is a very well prepared movie that describes the mis.pdf
 
1. Identify five differences between DNA replication and gene transc.pdf
1. Identify five differences between DNA replication and gene transc.pdf1. Identify five differences between DNA replication and gene transc.pdf
1. Identify five differences between DNA replication and gene transc.pdf
 
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
1.1Yearcash flowpresent value of cash inflow = cash flow(1+r).pdf
 
this is my code to count the frequency of words in a text file#.pdf
 this is my code to count the frequency of words in a text file#.pdf this is my code to count the frequency of words in a text file#.pdf
this is my code to count the frequency of words in a text file#.pdf
 
The ice allows the refluxed materials to crystall.pdf
                     The ice allows the refluxed materials to crystall.pdf                     The ice allows the refluxed materials to crystall.pdf
The ice allows the refluxed materials to crystall.pdf
 
1. b2. c (bed bug)3. d (caterpillars)4. c (lyme disease)5. e.pdf
1. b2. c (bed bug)3. d (caterpillars)4. c (lyme disease)5. e.pdf1. b2. c (bed bug)3. d (caterpillars)4. c (lyme disease)5. e.pdf
1. b2. c (bed bug)3. d (caterpillars)4. c (lyme disease)5. e.pdf
 
#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf#In this project you will write a program play TicTacToe #using tw.pdf
#In this project you will write a program play TicTacToe #using tw.pdf
 
Web sever environmentA Web server is a program that uses HTTP (Hy.pdf
Web sever environmentA Web server is a program that uses HTTP (Hy.pdfWeb sever environmentA Web server is a program that uses HTTP (Hy.pdf
Web sever environmentA Web server is a program that uses HTTP (Hy.pdf
 
We ca use HashSet data structure to remove duplicats from an array i.pdf
We ca use HashSet data structure to remove duplicats from an array i.pdfWe ca use HashSet data structure to remove duplicats from an array i.pdf
We ca use HashSet data structure to remove duplicats from an array i.pdf
 
this eample is of t-test for comparing two meanshere mean1 = m.pdf
this eample is of t-test for comparing two meanshere mean1 = m.pdfthis eample is of t-test for comparing two meanshere mean1 = m.pdf
this eample is of t-test for comparing two meanshere mean1 = m.pdf
 
The middle ear bones in mammals are derived from bones in the dentar.pdf
The middle ear bones in mammals are derived from bones in the dentar.pdfThe middle ear bones in mammals are derived from bones in the dentar.pdf
The middle ear bones in mammals are derived from bones in the dentar.pdf
 
There is an old saying “Do not put all eggs in one basket”WhyBe.pdf
There is an old saying “Do not put all eggs in one basket”WhyBe.pdfThere is an old saying “Do not put all eggs in one basket”WhyBe.pdf
There is an old saying “Do not put all eggs in one basket”WhyBe.pdf
 
The ER Model is focussed to be a description of real-world entities..pdf
The ER Model is focussed to be a description of real-world entities..pdfThe ER Model is focussed to be a description of real-world entities..pdf
The ER Model is focussed to be a description of real-world entities..pdf
 
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdfPlease find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
Please find the answers belowAnswer 16 Option A (IEP). (IEP or i.pdf
 
Question 1 answer is A Global trade allows wealthy countries to use .pdf
Question 1 answer is A Global trade allows wealthy countries to use .pdfQuestion 1 answer is A Global trade allows wealthy countries to use .pdf
Question 1 answer is A Global trade allows wealthy countries to use .pdf
 
Precipitation hardening, or age hardening, provides one of the most .pdf
Precipitation hardening, or age hardening, provides one of the most .pdfPrecipitation hardening, or age hardening, provides one of the most .pdf
Precipitation hardening, or age hardening, provides one of the most .pdf
 
Protists are beneficial to the ecosystem in generating oxygen as the.pdf
Protists are beneficial to the ecosystem in generating oxygen as the.pdfProtists are beneficial to the ecosystem in generating oxygen as the.pdf
Protists are beneficial to the ecosystem in generating oxygen as the.pdf
 
Now a normal O2 molecule has 12 electrons in the valence shell so, O.pdf
Now a normal O2 molecule has 12 electrons in the valence shell so, O.pdfNow a normal O2 molecule has 12 electrons in the valence shell so, O.pdf
Now a normal O2 molecule has 12 electrons in the valence shell so, O.pdf
 
operating system linux,ubuntu,Mac#include iostream #include .pdf
operating system linux,ubuntu,Mac#include iostream #include .pdfoperating system linux,ubuntu,Mac#include iostream #include .pdf
operating system linux,ubuntu,Mac#include iostream #include .pdf
 
Network Protocol1) A Protocol is used for the communication betwe.pdf
Network Protocol1) A Protocol is used for the communication betwe.pdfNetwork Protocol1) A Protocol is used for the communication betwe.pdf
Network Protocol1) A Protocol is used for the communication betwe.pdf
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
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
AnaAcapella
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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Ă...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.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
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
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
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 

P1.javaimport java.util.Scanner;keyboard inputting package pub.pdf

  • 1. P1.java import java.util.Scanner;//keyboard inputting package public class P1 {//main class public static void main(String[] args) {//main method Scanner input = new Scanner (System.in); //User will input values System.out.print("Enter your weght in pounds:"); int weight = input.nextInt();//keyboard inputting //User will input values System.out.print("Enter your feet and inches:"); int feet = input.nextInt();//keyboard inputting int inches=input.nextInt(); int totalheightininches=0; totalheightininches=(feet*12)+inches;//converting feet and inches into total inches float bmi; float constant=703f; bmi = (float) (weight /Math.pow(totalheightininches,2))*constant;//bmi calculation //Print out results on display System.out.println("BMI is" + bmi); if(bmi <18.5) System.out.println("Underweight"); else if (bmi <25) System.out.println("Normal"); else if (bmi < 30) System.out.println("Overweight"); else System.out.println("Obese"); } } output Enter your weght in pounds:150 Enter your feet and inches:5 5 BMI is24.95858 Normal
  • 2. Solution P1.java import java.util.Scanner;//keyboard inputting package public class P1 {//main class public static void main(String[] args) {//main method Scanner input = new Scanner (System.in); //User will input values System.out.print("Enter your weght in pounds:"); int weight = input.nextInt();//keyboard inputting //User will input values System.out.print("Enter your feet and inches:"); int feet = input.nextInt();//keyboard inputting int inches=input.nextInt(); int totalheightininches=0; totalheightininches=(feet*12)+inches;//converting feet and inches into total inches float bmi; float constant=703f; bmi = (float) (weight /Math.pow(totalheightininches,2))*constant;//bmi calculation //Print out results on display System.out.println("BMI is" + bmi); if(bmi <18.5) System.out.println("Underweight"); else if (bmi <25) System.out.println("Normal"); else if (bmi < 30) System.out.println("Overweight"); else System.out.println("Obese"); } } output Enter your weght in pounds:150 Enter your feet and inches:5 5