I'm starting to learn java and I have a trouble with one of my programme. I'm trying to obtain the inductance of an antenna depending on the type of antenna enter by the user. The problem is that I have the dialog box and I enter the input, but after that my code stop and it didn't do the loop. I have been looking over the web and I can't find why my input is not acceptable by the if statement. This is part of my code:
import javax.swing.*; //import javax.swing.JOptionPane;
public class Antenna_Inductance {
public static void main(String[] args) {
// first we will define all the variable use of the problem set
// for the lime antenna
double M;
int N1;
int N2;
double R1;
double R2;
// now we can start to programmed the main code
String Type= JOptionPane.showInputDialog("Type of Antenna");
// this is where the code stop and i don't know why
if (Type == "line") {
String input_rmin= JOptionPane.showInputDialog("Enter minimum distance for r");
double rmin = Double.parseDouble(input_rmin);
String input_rmax= JOptionPane.showInputDialog("Enter maximum distance for r");
double rmax = Double.parseDouble(input_rmax);
I = 0.01;
for (r=rmin; r==rmax ;r+=0.05) {
B_line = (mu*I)/(2*pi*r);
System.out.println("Inductance for line antenna =" + B_line);
}
So, i could really use some help on this one. Thank you and have a nice day
Aucun commentaire:
Enregistrer un commentaire