Skip to content

Instantly share code, notes, and snippets.

@GrantSchiller
Last active January 3, 2016 04:59
Show Gist options
  • Save GrantSchiller/8413001 to your computer and use it in GitHub Desktop.
Save GrantSchiller/8413001 to your computer and use it in GitHub Desktop.
package test_1;
public class Temp {
public static void main(String[] args)
{
Temp temp = new Temp();
}
public Temp()
{
System.out.println("32 F to C is... ");
System.out.println(convertDegrees(32,"C"));
System.out.print("0 C to F is... ");
System.out.println(convertDegrees(0,"F"));
}
public float convertDegrees(float input, String which)
{
if(which.equals("C"))
{
return (float) ((input - 32) / 5/9);
}
else if(which.equals("F"))
{
return (float) ((input * 5/9) + 32);
}
else
{
return 1337;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment