In class I have to create a java program that has to use the user method. Here is my code.
1 import java.text.*;
2 import javax.swing.*;
3 import java.io.*;
4 public class Fahrenheit3
5 {
6 public static void main (String [] args)throws Exception
7 {
8 String inFahrenheit;
9 Double f,
10 c;
11 char input;
12 int yes=1, no=2;
13
14 do
15 {
16 inFahrenheit= JOptionPane.showInputDialog("Enter a Number");
17 f=Double.parseDouble(inFahrenheit);
18 c=(f-32.0) * (5.0/9.0);
19 // input= JOptionPane.showInputDialog(null,"Do you want to continue?");
20 input=Double.parseDouble(inFahrenheit);
21 }
22
23 while (JOptionPane.showInputDialog (null,"Do you want to continue");//.charAt(0) == 'y');
24
25 }