Code Tidy - Pastebin

New     Fork     Embed     View raw     Report
CODE BULLSHIT - text

Embed

You can embed this paste into a blog or website with this code:

<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/1850" frameborder="0"></iframe>

Add comment

Captcha
  1. import java.io.*;?
  2. import java.util.Scanner;?
  3. import java.io.IOException;?
  4. import java.lang.*;?
  5.  ?
  6. public class main?
  7. {?
  8.     static void main(String[] args)?
  9.     {?
  10.         Scanner charInput = new Scanner(System.in);?
  11.         Scanner fl_in = new Scanner(System.in);?
  12.         String whichMethod;?
  13.         char finalSel;?
  14.         int aMethod = 0;?
  15.         int mMethod = 0;?
  16.         ?
  17.         System.out.println("Which method would you like to use? (A)merican or (M)etric");?
  18.         whichMethod = charInput.next();?
  19.         System.out.println(whichMethod.length());?
  20.             if(whichMethod == "A" || whichMethod == "a")?
  21.             {?
  22.                 aMethod = 1;?
  23.                 mMethod = 0;?
  24.             }?
  25.             else if(whichMethod == "M" || whichMethod == "m")?
  26.             {?
  27.                 aMethod = 0;?
  28.                 mMethod = 1;?
  29.             }  ?
  30.             ?
  31.         // Variables for Calculations?
  32.         double weight;?
  33.         double height;?
  34.         double BMI;?
  35.         // Start of input?
  36.         System.out.println(aMethod);?
  37.         System.out.println(mMethod);?
  38.         ?
  39.         if (aMethod < mMethod) {?
  40.             // American Method?
  41.             System.out.println("Please enter your weight in pounds: ");?
  42.             weight = fl_in.nextFloat();?
  43.             System.out.println("Please enter your height in inches: ");?
  44.             height = fl_in.nextFloat();?
  45.         }else{?
  46.             System.out.println("Please enter your weight in kilograms: ");?
  47.             weight = charInput.nextFloat();?
  48.  ?
  49.            ?
  50.             height = charInput.nextFloat();?
  51.         }?
  52.         ?
  53.         if (aMethod < mMethod) {?
  54.             // American Method?
  55.             BMI = (weight * 703) / Math.pow(height,2);?
  56.             ?
  57.         }else{?
  58.             BMI = weight / Math.pow(height,2);?
  59.         }?
  60.         ?
  61.         if(BMI > 25)?
  62.         {?
  63.            System.out.println("Your fat");?
  64.         }else if (BMI < 18.5)?
  65.         {?
  66.             System.out.println("Too Skinny");?
  67.         }else{?
  68.             System.out.println("Very Nice");?
  69.         }?
  70.     System.out.println("YOUR BMI IS "+BMI+"!");?
  71.     }?
  72. }?
© 2011 Code Tidy  Terms and conditions