I have the following as my code, and i cant figure out why i am getting this error. I think it has to do with my While statement. Please help!
import javax.swing.*;
import java.lang.String;
public class FollowingDate
{
public static void main(String[] args)
{
String date, month, day, year;
int daysFeb = 28;
int numDay, numYear, indexOfFirstSlash, indexOfSecondSlash;
int slashCount, numMonth, charCount;
final int daysJan = 31, daysMar = 31, daysApr = 30, daysMay = 31;
final int daysJun = 30, daysJul = 31, daysAug = 31, daysSep = 30;
final int daysOct = 31, daysNov = 30, daysDec = 31;
date = JOptionPane.showInputDialog("Enter a date in the form: "
+ "month/day/year");
while (!date.equals("#"))
{
for (charCount = 0; charCount < date.length(); charCount++)
{
if (date.charAt(charCount) != "/")
{
if (date.charAt(charCount) < '0' || date.charAt(charCount) > '9')
System.out.println("Incorrect input format");
indexOfFirstSlash = date.indexOf('/');
indexOfSecondSlash = date.indexOf('/', indexOfFirstSlash + 1);
month = date.substring(0, indexOfFirstSlash);
day = date.substring(indexOfFirstSlash + 1, indexOfSecondSlash);
year = date.substring(indexOfSecondSlash + 1, date.length());
numMonth = Integer.parseInt(month.trim());
numDay = Integer.parseInt(day.trim()) + 1;
numYear = Integer.parseInt(year.trim());
if (numYear % 4 == 0){
if (numYear % 400 == 0)
daysFeb = daysFeb + 1;
else if (numYear % 100 != 0)
daysFeb = daysFeb + 1;
}
if (numMonth == 1 && numDay > daysJan){
numMonth++;
numDay = 1;
}
else if (numMonth == 2 && numDay > daysFeb){
numDay = 1;
numMonth++;
}
else if (numMonth == 3 && numDay > daysMar){
numDay = 1;
numMonth++;
}
else if (numMonth == 4 && numDay > daysApr){
numDay = 1;
numMonth++;
}
else if (numMonth == 5 && numDay > daysMay){
numDay = 1;
numMonth++;
}
else if (numMonth == 6 && numDay > daysJun){
numDay = 1;
numMonth++;
}
else if (numMonth == 7 && numDay > daysJul){
numDay = 1;
numMonth++;
}
else if (numMonth == 8 && numDay > daysAug){
numDay = 1;
numMonth++;
}
else if (numMonth == 9 && numDay > daysSep){
numDay = 1;
numMonth++;
}
else if (numMonth == 10 && numDay > daysOct){
numDay = 1;
numMonth++;
}
else if (numMonth == 11 && numDay > daysNov){
numDay = 1;
numMonth++;
}
else if (numMonth == 12 && numDay > daysDec){
numMonth = 1;
numYear++;
numDay = 1;
}
switch (numMonth)
{
case 1:
month = "January";
break;
case 2:
month = "February";
break;
case 3:
month = "March";
break;
case 4:
month = "April";
break;
case 5:
month = "May";
break;
case 6:
month = "June";
break;
case 7:
month = "July";
break;
case 8:
month = "August";
break;
case 9:
month = "September";
break;
case 10:
month = "October";
break;
case 11:
month = "November";
break;
case 12:
month = "December";
break;
}
JOptionPane.showMessageDialog(null, "The following date is: " +
month + " " + numDay + ", " + numYear);
}
)
)
}
}