/** * Write a description of class Conversion here. * * @author (your name) * @version (a version number or a date) */ import java.util.Scanner; public class Conversion { // instance variables - replace the example below with your own public static int display; public static String show = "Decimal"; static String answer = ""; static Scanner scan = new Scanner(System.in); public static double switchDisplay(double value){ System.out.println("choose from: binary, octal, decimal, and hexadecimal \n" +"to convert answer"); String input = scan.nextLine(); int[] displayOptions= new int[]{2,8,10,16}; if(input.equalsIgnoreCase("binary")){ display = displayOptions[0]; System.out.println("binary"); //answer = (double)Integer.toBinaryString((Functions.value)); answer = Long.toBinaryString(Double.doubleToRawLongBits(Functions.value)); } else if(input.equalsIgnoreCase("octal")){ display = displayOptions[1]; System.out.println("octal"); Long.toOctalString(Double.doubleToRawLongBits(Functions.value)); } else if(input.equalsIgnoreCase("decimal")){ display = displayOptions[2]; System.out.println("answer already in decimal mode"); } else if(input.equalsIgnoreCase("hexadecimal")){ display = displayOptions[3]; System.out.println("hexadecimal selected"); answer = Double.toHexString(Functions.value); } else{ System.out.print("Invalid choice try again"); display = display; } System.out.println(answer); return 0; } }