I am creating a program that will allow a person to input a month, day and year and this program will convert it to the day of the year. However, I want it to loop until the person puts in a -1. How do i get it to loop?


public void findCalen(){
String prompt = "Enter a month or -1 to stop";
int num1=readInt(prompt);
if (num1!=-1){
String dayStr=JOptionPane.showInputDialog(null,"Enter a day");
int dayA=Integer.parseInt(dayStr);

String yearStr=JOptionPane.showInputDialog(null,"Enter a year");
int yearA=Integer.parseInt(yearStr);
int (yearA % 100 == 0 || yearA % 4 == 0) {
switch (num1){
case 1:numOfDays=dayA;
System.out.println(numOfDays);
break;
.
.
.
case 12:numOfDays = 335+dayA;
System.out.println(numOfDays);}
}

else
switch (num1){
case 1:numOfDays = dayA;
System.out.println(numOfDays);
break;
.
.
.
case 12:numOfDays = 334+dayA;
System.out.println(numOfDays);}
}
else{
System.out.println("good bye"); }
}