I have having trouble with a program my teacher gave me and I was wondering if someone can point me in the right direction. I have to write a program that prints the following information: The date and weekday that is 100 days from today, the weekday of your birthday, and the date that is 10,000 days from your birthday. I am just working on the first one: the date and weekday that is 100 days from today.
My teacher didn't show us how to do this in class so I looked in the book and been using Java Platform SE 7. But still can't figure out how to use these methods. here is what i have so far.
public class HomeWork3Part4
public static void main(String args)
GregorianCalendar cal = new GregorianCalendar();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
int weekDay = cal.get(Calendar.DAY_OF_WEEK);
System.out.println("Year: " + year + ", Month: " + month + ", day of month: " + dayOfMonth + ", weekday: " + weekDay );
// I tried doing this but doesn't work.... cal.add(weekDay, 100); but add is an abstract void so i don't understand how to print it if it doesn't return anything
Now i know there is an add method but it doesn't return anything so i don't under why / how to use it. I can't assign it to a variable or print out. I also don't understand what the point of using the constructor like so, GregorianCalender cal = new GregorianCalendar(2012, Calendar.MONTH, 12); when I can't store cal in a variable and print or manipulate that date.
Any help would be greatly appreciated. I'm not looking for someone to do this code just push me in the right direction, I really want to understand whats going on.