I am writing a program in Java that allows the user to select a choice (1 : New, 2: Print Range, 3: Print All, quit). Once they choose one of the above they then enter the appointment date if they chose "New" and also enter a description for the appointment and lastly they pick if the appointment will be (1 = Once, 2 = Daily, 3 = Monthly).
I am getting an error on the line "if (list.i.compareTo(lowDate) <= 0) && (list.i.compareTo(highDate) >= 0);" It is giving me the error "AppointmentNew.java:69: illegal start of expression". I am not sure exactly why it is giving me that error!
Here is my code, I believe I have it all completed to carry out the above tasks!
import java.util.*;
public class AppointmentNew
{
public static void main (String[] args)
{
List<String> list = new ArrayList<String>();
Scanner stdin = new Scanner(System.in);
String choice = "";
int choiceNum = 0;
String date = "";
String descrip = "";
int type = 0;
String typeChose = "";
System.out.println("Welcome to Appointment App!\n");
System.out.println("\t============================\n");
do
{
System.out.print("\tMake Choice ( 1: New, 2: Print Range, 3: Print All, quit): ");
choice = stdin.nextLine();
choiceNum = Integer.parseInt(choice);
if (choiceNum == 1)
{
System.out.print("\n\n\tEnter New Appointment Date in mm/dd/yyyy format: ");
date = stdin.nextLine();
System.out.print("\n\n\tEnter New Appointment Description: ");
descrip = stdin.nextLine();
System.out.print("\n\n\tEnter Type (1 = Once, 2 = Daily, 3 = Monthly): ");
type = stdin.nextInt();
if (type == 1)
{
Once once = new Once(date, descrip);
typeChose = "One-Time";
}
else if (type == 2)
{
Daily daily = new Daily(date, decrip);
typeChose = "Daily";
}
else
{
Monthly monthly = new Monthly(date, descrip);
typeChose = "Monthly";
}
String stringToAdd = "";
strinToAdd = "New " + descrip + " Appointment Added for " + date;
list.append(stringToAdd);
System.out.println("\n\n\tNew " + typeChose + " Appointment Added for " + date);
}
if (choiceNum == 2)
{
System.out.print("\n\n\tEnter START Date in mm/dd/yyyy format: ");
String lowDate = stdin.nextLine();
System.out.print("\n\n\tEnter END Date in mm/dd/yyyy format: ");
String highDate = stdin.nextLine();
for(int i = 0; i < list.size(); i++)
{
int dateSpot = list.i.indexOf(" ");
if (list.i.compareTo(lowDate) <= 0) && (list.i.compareTo(highDate) >= 0);
{
System.out.println(list.i);
}}
}
if (choiceNum == 3)
{
for(int i = 0; i < list.size(); i++)
{
System.out.println(list.i);
}
}
}while (choice != "quit");
} }
Thank you in advance for any help!