# Converting this code from Celsius to Fahrenheit

**URL:** <https://discourse.processing.org/t/converting-this-code-from-celsius-to-fahrenheit/21221>\
**Category:** Coding Questions\
**Created:** [May 23, 2020, 9:41pm UTC](https://discourse.processing.org/t/converting-this-code-from-celsius-to-fahrenheit/21221 "2020-05-23T21:41:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobcat21976](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@bobcat21976](https://discourse.processing.org/u/bobcat21976)\
**Post date:** [May 23, 2020, 9:41pm UTC](https://discourse.processing.org/t/converting-this-code-from-celsius-to-fahrenheit/21221/1 "2020-05-23T21:41:54Z")

</div>

```auto
import javax.swing.JOptionPane;

int FREEZE_F=32;
int BOIL_F=212;
int temp ;
String scale;
String answer= JOptionPane.showInputDialog("Enter the temperature in degrees: ");
temp= Integer.parseInt(answer);
scale = JOptionPane.showInputDialog("Enter C for Celsius or F for Fahrenheit: ");
if (scale.equals("F"))
{
  if (temp <= FREEZE_F)
  println("Solid");
  else if (temp>= BOIL_F)
  println("Gas");
  else
  println("liquid");
}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 23, 2020, 9:49pm UTC](https://discourse.processing.org/t/converting-this-code-from-celsius-to-fahrenheit/21221/2 "2020-05-23T21:49:32Z")

</div>

> **[OpenWeatherMapJSON](https://bl.ocks.org/GoSubRoutine/5fbc03e019c53254a2ba7e7fd3318b45)**
>
> GoSubRoutine’s Block 5fbc03e019c53254a2ba7e7fd3318b45

  

> <https://gist.github.com/GoSubRoutine/5fbc03e019c53254a2ba7e7fd3318b45>
