Last active
January 3, 2016 04:59
-
-
Save GrantSchiller/8413001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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