Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Brandon Murphy
- import java.util.*;
- public class TempConverter
- {
- public static void main(String [] args)
- {
- int tempF = new Int(0);
- int tempC = new Int(0);
- int tempValue = new Int(0);
- int tempNew = new Int(0);
- int conversionType = new Int(0);
- int fConverter = new Int(1.8);
- int cConverter = new Int(0.5555555555555556);
- System.out.print( "Enter F to convert Fahrenheit, C to convert Celsius. " );
- int conversionType = in.nextLine();
- System.out.print( "Please enter the temperature you would like to convert. " );
- int tempVale = in.nextLine();
- if (conversionType == F){
- int tempNew = tempValue - 32;
- int tempNew = tempNew * cConverter;
- System.out.println( tempValue + "in Celsius is" + tempNew);
- }
- if (conversionType == C){
- int tempNew = tempValue + 32;
- int tempNew = tempNew * fConverter;
- System.out.println( tempValue + "in Fahrenheit is" + tempNew);
- }
- else {
- System.out.println( "Invalid temperature type" );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement