I am very new to Java Programming, I have been given a task to work out from user input the easter date for a given year and then to ask if the user would like to input another year to calculate another easter date. What I don't understand is how to create a loop from the second input box ("Noch eine Berechnung? (J/N)") that repeats the entire process again. My code is this:
import javax.swing.JOptionPane;
public class Osterberechnung_ohne_schleife {
public static void main(String[] args) {
String sJahrEingabe = JOptionPane.showInputDialog("Bitte Jahr eingeben:");
int iJahr = Integer.parseInt(sJahrEingabe);
int iP = iJahr / 100;
int iQ = iP / 3;
int iR = iQ / 4;
int iX = (15 + iP - iQ - iR) % 30;
int iY = (iP + 4 - iR) % 7;
int iA = iJahr % 19;
int iB = iJahr % 4;
int iC = iJahr % 7;
int iD = (19 * iA + iX) % 30;
int iE = (2 * iB + 4 * iC + 6 * iD + iY) % 7;
if ((iD == 29) && (iE == 6)) {
System.out.println("Ausgabe: Ostern ist am 19.April");
} else if ((iD == 28) && (iE == 6)) {
System.out.println("Ausgabe: Ostern ist am 18.April");
} else if ((22 + iD + iE) <= 31) {
System.out.println("Ausgabe: Ostern ist am " + (22 + iD + iE) + ".März");
} else {
System.out.println("Ausgabe: Ostern ist am " + (iD + iE - 9) + ".April");
}
{
String sNochJahr = JOptionPane.showInputDialog("Noch eine Berechnung? (J/N)");
}
}
}
Thanks in advance for your help.
J.