Public feed #887040

Stuff

public text v1 · immutable
Raw Edit
·published 2008-02-01 02:39 UTC
rendered paste body
// Alexander Clark
// Test program for Date Class
// 1/30/08
import java.util.Scanner;

public class DateTest
{

   public static void main( String args[] )
   {
	  Scanner input = new Scanner(System.in);

	  int userMonth = 00;
	  int userDay = 00;
	  int userYear = 00;


      Date calendar1 = new Date();

      System.out.println("Current Date: " + calendar1.getMonth() + "/" + calendar1.getDay() + "/" + calendar1.getYear());
      System.out.print("Please enter the Month (01-12): ");
	  userMonth = input.nextInt();
	  calendar1.setMonth(userMonth);

      System.out.print("Please enter the Day (00-31): ");
      userDay = input.nextInt();
	  calendar1.setDay(userDay);

      System.out.print("Please enter the Year (0000-9999): ");
      userYear = input.nextInt();
	  calendar1.setYear(userYear);

	  System.out.println("The date is now: " + calendar1.getMonth() + "/" + calendar1.getDay() + "/" + calendar1.getYear());


   } // end main

} // end class GradeBookTest


//Calendar.setMonth(TestMonth)