Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Join our platform to connect with experts ready to provide accurate answers to your questions in various fields. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

Write java program quickly please i will wait your solving

Write Java Program Quickly Please I Will Wait Your Solving class=

Sagot :

genan

Answer:

Output:

Ali : Very  Overweight

Mohammed : Very  Overweight

Salma : Very  Overweight

Huda : Normal

Jassim : Very  Overweight

Fatima : Very  Overweight

Explantion:

Step 1: Code is Given Below

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

public class BMI {

public static void main(String[] args) throws IOException {

 File file=new File("People.txt");    //creates a new file instance  

 FileReader fr=new FileReader(file);   //reads the file  

 BufferedReader br=new BufferedReader(fr);    

 String line;  

 //read file line by line

 while((line=br.readLine())!=null){  

  //split line by space

  String data[]=line.split(" ");

  //extract name, weight and height

  String name=data[0];

  int weight=Integer.parseInt(data[1]);

  double height=Double.parseDouble(data[2]);

  //find BMI

  double bmi=weight/(height*height);

  System.out.print(name+" : ");

  //check if BMI Class

  if(bmi<18.5)

   System.out.println("Underweight");

  else if(bmi<=24.9)

   System.out.println("Normal");

  else if(bmi<=29.9)

   System.out.println("Overweight");

  else

   System.out.println("Very Overweight");

 }  

}

}

Hope this helps, Let me know if you have any questions !

Screenshot for more organize set up of the code

View image genan
View image genan
Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Keep exploring Westonci.ca for more insightful answers to your questions. We're here to help.