﻿
import java.util.Scanner; 
public class Converter {

    public void celtofar(){
        Scanner input = new Scanner(System.in);
        float cel;
        float far;
        System.out.print("Enter your input in a celsius = ");
        cel = input.nextFloat();

        far = cel * 9/5 + 32;

        System.out.println( " is " + far + " in Fahrenheit");

    }
    public void fartocel(){
        Scanner input = new Scanner(System.in);
        float cel,far;
        System.out.print("please enter in a Fahrenheit = ");
        far = input.nextFloat();

        cel = (5/9) * (far-32);

        System.out.println( "is " + cel + " in Celsius");


    }

    public static void main(String[] args) {

       
        Scanner input = new Scanner(System.in);
        Converter obj = new Converter();

        float result;

        System.out.print("Enter 1 for celsius to fahrenheit \nEnter 2 for fahrenheit to celsius ");
            result = input.nextFloat();

            if(result == 1){
                obj.celtofar();
            }

            else if (result == 2){
                obj.fartocel();
            }

            else{
                System.out.println("Invalid input!");


            }


    }

}
