Problem with sending a GregorianCalender HELP
right i am studying a degree course and i am having trouble with this line of code-
Code Java:
public static void main(String [] args)
{
Item rent1 = new Item(1000001, "Last Samurai", "Action", 2004, "15", new GregorianCalendar(2010,3,15 ) );
rent1.returnItem(Date_Last_Returned)
rent1.display();
}
}
this is my main application and below is the code that will not work correctly-
rent1.returnItem(Date_Last_Returned)
i am sending this back to this item class-
Code Java:
import java.util.GregorianCalendar;
public class Item
{
private int identifier;
private String title;
private String genre;
private int year_released;
private String classification;
private GregorianCalendar Date_Last_Returned;
private boolean available;
public Item(int identifier, String title, String genre, int year_released, String classification, GregorianCalendar Date_Last_Returned)
{
this.identifier=identifier;
this.title=title;
this.genre=genre;
this.year_released=year_released;
this.classification=classification;
this.Date_Last_Returned=Date_Last_Returned;
}
public GregorianCalendar getDate()
{
return Date_Last_Returned;
}
public void display()
{
System.out.println("Here is the identifier- "+identifier);
System.out.println("Here is the Date Last Returned- "+Date_Last_Returned.getTime());
}
public GregorianCalendar returnItem(GregorianCalendar Date_Last_Returned)
{
Date_Last_Returned.set(2010, 3,16);
available=true;
return Date_Last_Returned;
}
}
this line of code is frying my head and i can not see or figure out why it is not working for me, can anyone help please???
Re: Problem with sending a GregorianCalender HELP
What do you mean by it isn't working? What is happening that shouldn't?
Re: Problem with sending a GregorianCalender HELP
rent1.returnItem(Date_Last_Returned);
is causing an error because Date_Last_Returned cannot be resolved to a variable
You are calling the returnItem(); method with Date_Last_Returned as an argument but Date_Last_Returned is not a variable declared in this class.
The method:
Requires a GregorianCalendar argument.
To demonstrate, try adding this to your main method: