ProtusMose.com

A slick and polished mess.


follow protusmose at http://twitter.com

Apr

05

It’s two things at once!

Posted by: mose

Posted in: Fantastic!

import javax.swing.JOptionPane;

public class FahrenheitToCelciusTwo {
public static void main(String[] args) {
//Prompt the user for input
String inputValueString = JOptionPane.showInputDialog(
null, “Please enter a temperature in Fahrenheit:”);

// Convert string to double
double inputValue =
Double.parseDouble(inputValueString);

// Calculate temperature in Celcius
double temperatureInCelcius =
(5.0 / 9) * (inputValue – 32);

// Display Results
String output = “The temperature in Celcius is ” + temperatureInCelcius;
JOptionPane.showMessageDialog(null, output);
}
}
********************

This program is both boring and awesome.

If you know programing, it’s probably readily apparent that this is a beginner’s work and you could probably think of 10 different ways to do it better.

If you don’t know programming, that’s pretty impressive, eh? The best part is, after two hours of tweaking, it works.

Finally.

Now I can go take a shower and go to bed.

Leave your comment