Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *5
- *74 220 Captain Hook
- *65 98 Peter Pan
- *6 1 Tinker Bell
- *78 190 Knightro
- *48 100 Humpty Dumpty
- */
- /**
- * Name: Michael Hahn
- * Course: COP 3330 - Spring 2015
- * University of Central Florida
- */
- package bmi;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- public class Bmi{
- /*
- *
- * @param args
- */
- public static void main(String[] args){
- Scanner scanner;
- try {
- scanner = new Scanner(new FileInputStream("bmidata.txt"));
- } catch (FileNotFoundException ex) {
- Logger.getLogger(Bmi.class.getName()).log(Level.SEVERE, null, ex);
- }
- System.out.println("BMI Report:\n");
- int totalCases = scanner.nextInt();
- for(int count=0; count<=totalCases; count++){
- int height = scanner.nextInt();
- int weight = scanner.nextInt();
- String name = scanner.nextLine();
- float BMI = (weight*703)/(height*height);
- // Enter in a print statement here for Name: Height: Weight: and BMI:
- //
- if(BMI>=30){
- System.out.println(" Obese\n");
- }
- if((BMI>=25) && (BMI<=29.9)){
- System.out.println(" Overweight\t");
- }
- if((BMI>=18.5) && (BMI<=24.9)){
- System.out.println(" Normal\t");
- }
- if(BMI<18.){
- System.out.println(" Underweight\t");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement