I am new to this website and to java so please forgive the messy code.
import javax.swing.JOptionPane;
public class MusterTest {
public static void main(String[]args) {
String zeichen = null;
int laenge = 0;
int hoehe = 0;
Muster.rechteck(zeichen, laenge, hoehe);
System.out.print(zeichen +laenge+ +hoehe);
}
}
class Muster {
public static int zeile(String zeichen, int laenge) {
zeichen = JOptionPane.showInputDialog(null, "Which Symbol?");
String wLaenge = JOptionPane.showInputDialog(null, "Length?");
laenge = Integer.parseInt(wLaenge);
return laenge;
}
public static int rechteck(String zeichen, int laenge, int hoehe) {
zeile(zeichen, laenge);
String wHoehe = JOptionPane.showInputDialog(null, "Height?");
hoehe = Integer.parseInt(wHoehe);
return hoehe;
}
}
What I'm trying to achieve here, the user inputs the a Symbol (in the String zeichen) and then two values (in hoehe and laenge) inside the methods.
After that, I'm supposed to use the method in void main.
My problem is, when I print the variables it does not print the values that the user inputs. Instead it just prints: null,00 (so the values did not change). Any advice on how I could fix this?
(Note: This is an assignment, it specifically must be done with the use of these two methods, so please keep that in mind for those who give advice.)