Marketplace | Fahrenheit 9/11 C using the Java program!? How can I get this program to exit without touching the do loop, please help I tryed for hours and could not understand.
java.util.Scanner import; javax.swing.JOptionPane import;
public class (Celcius2Farenheit static String x2 = "exit";
static Scanner = new Scanner (System.in);
/ ** * @ Param args * @ Return * public static void main (String [] args) ( / / TODO Auto-portal method generated
null JOptionPane.showMessageDialog ("Running Start ..."," Celsius Fahrenheit by Neil D'Souza, JOptionPane.INFORMATION_MESSAGE); null JOptionPane.showMessageDialog ("Conversion Celsius to Fahrenheit);
C (
System.out.println ("Please enter a temperature to convert"); String userinput = scanner.nextLine (); if (userInput.equals (x2));
try (
CEL = double Double.parseDouble (userinput); celToF (CEL);
) Catch (NumberFormatException ex) ( System.err.println ("Invalid characters);
)
) While (true);
)
Public static void Exit () ( if (scanner.nextLine (). equals (x2)); null JOptionPane.showMessageDialog ("Withdrawal Conversion Celsius to Fahrenheit", "Exit", JOptionPane.INFORMATION_MESSAG ... System.exit (-1);
)
public static double celToF (CEL double) ( double farenheit = cel * 9 / 5.0 + 32.0; null JOptionPane.showMessageDialog ("temperature" + "" + CEL + "" + "C" + "" + "is" + "Fahrenheit + +" "+" Fahrenheit);
Fahrenheit return;
) ) your last line before the entrance) System.exit. (0);
my schedule was like that;
javax.swing.JOptionPane import;
public class convertfahrenheittocelsius ( public static void main (String [] args) (
/ / Declare variables Double fahrenheit;
/ / Declare input string degreesfahrenheitstr String;
/ / Declare output channel C string;
/ / Get feedback degreesfahrenheitstr = JOptionPane.showInputDialog ("Enter degrees Fahrenheit:");
/ / Analysis of a double Fahrenheit = Double.parseDouble (degreesfahrenheitstr) ...
/ / Output Format String Fahrenheit Format Celsius = String.Format ("Your temperature is% .2 f degrees Celsius" (Fahrenheit - 32) * (5,0 / 9,0));
/ / Output of message box JOptionPane.showMessageDialog (null, C, "Your temp in degrees Celsius," JOptionPane.INFORMATION_MESSAGE); / Program / Output System.exit (0);
) )
Hope this helps:) Posted on May 21, 2010.
CommentsThere are no comments.Leave a Comment | Newest Posts The Man With The Golden Arm Man Who Fell To Earth Versus Slacker No Holds Barred Spawn Of The Slithis Great Escape, The I'm All Right Jack
My Friends Marc Jacobs Shopping HTC Touch Zone Celebrity Resource Car Zing Vespa Store Skechers Superstore Anne Geddes Store Fred Perry Shopping Muscle Carts Welterweight Online
|