0

I need to use a date constructor. I need to create the Date object in one file and pass it in to a method as is.

public Date(int year,
               int month,
               int date)

I have two classes, one with get/set setters and the other one is my driver/tester. I have this in my driver....

 System.out.print("Enter Date (MM/dd/YYYY): ");
  toDoItems.add(testDueDate = k.next());

I dont know how to set up the get/set setters in the other class and how to implement the testDueDate to store three sets of integers and all as one thing to be added into the toDoItems ArrayList so that I can later use it to print hte results:

return ToDoItem.getDescription()+" "+"-"+ToDoItem.getPriority()+"-"+" "+"("+ToDoItem.getDueDate()+")";
pyuntae
  • 742
  • 3
  • 10
  • 25

1 Answers1

0

You can create date object like below:

DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
Date inputDate = dateFormat.parse(testDueDate );

And you can store inputDate into your ToDoItem

Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
  • But how do i get the program to ask for the user input for each integer then put it all together so it is in that format ? – pyuntae Oct 09 '15 at 09:01