Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. /**
  2. *5
  3. *74 220 Captain Hook
  4. *65 98 Peter Pan
  5. *6 1 Tinker Bell
  6. *78 190 Knightro
  7. *48 100 Humpty Dumpty
  8. */
  9.  
  10. /**
  11. * Name: Michael Hahn
  12. * Course: COP 3330 - Spring 2015
  13. * University of Central Florida
  14. */
  15.  
  16. package bmi;
  17.  
  18. import java.io.FileInputStream;
  19. import java.io.FileNotFoundException;
  20. import java.util.Scanner;
  21. import java.util.logging.Level;
  22. import java.util.logging.Logger;
  23. public class Bmi{
  24.  
  25. /*
  26. *
  27. * @param args
  28. */
  29. public static void main(String[] args){
  30.  
  31. Scanner scanner;
  32. try {
  33. scanner = new Scanner(new FileInputStream("bmidata.txt"));
  34. } catch (FileNotFoundException ex) {
  35. Logger.getLogger(Bmi.class.getName()).log(Level.SEVERE, null, ex);
  36. }
  37. System.out.println("BMI Report:\n");
  38. int totalCases = scanner.nextInt();
  39. for(int count=0; count<=totalCases; count++){
  40. int height = scanner.nextInt();
  41. int weight = scanner.nextInt();
  42. String name = scanner.nextLine();
  43. float BMI = (weight*703)/(height*height);
  44. // Enter in a print statement here for Name: Height: Weight: and BMI:
  45.  
  46. //
  47. if(BMI>=30){
  48. System.out.println(" Obese\n");
  49. }
  50. if((BMI>=25) && (BMI<=29.9)){
  51. System.out.println(" Overweight\t");
  52. }
  53. if((BMI>=18.5) && (BMI<=24.9)){
  54. System.out.println(" Normal\t");
  55. }
  56. if(BMI<18.){
  57. System.out.println(" Underweight\t");
  58. }
  59. }
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement