Question: Java Programming Help!!! Why is it giving me error on BlueJ? import java.util.ArrayList; import java.util.Iterator; import java.util.Collections; import java.util.Random; /** * Write a description of
Java Programming Help!!! Why is it giving me error on BlueJ?
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Collections;
import java.util.Random;
/**
* Write a description of class AppointmentBook here.
*
* @author ()
* @version 1
*/
public class AppointmentBook {
// instance variables - replace the example below with your own
ArrayList
/**
* Constructor for objects of class AppointmentBook
*/
public AppointmentBook()
{
// initialise instance variables
dateList = new ArrayList<>();
}
public void addDate(Date d)
{
dateList.add(d);
}
public int removeDate(int index)
{
dateList.remove(index);
return index;
}
public void reverseOrder()
{
Collections.reverse(dateList);
}
public void removeDates(int month)
{
Random rand = new Random();
Date nextDate = rand.nextInt();
Iterator
while(it.hasNext())
{
nextDate = it.next();
if(month = nextDate.getMonth())
{
dateList.remove(index);
}
}
}
public void printAppointments()
{
for(Date Date: dateList)
{
System.out.println(Date.getMonth() + "/" + Date.getDay() + "/" + Date.getYear());
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
