I am trying to make a program that user is able to enter a date like: 28 -03 - 2014
.
This and the program reads that, gives the date of tomorrow like: 29 - march - 2014
.
The program must check about:
- String max 10.
- date of day(2 digit): 1 - 31
- String:
-
- month (two digit): 1 - 12
- String:
-
- year : four digits
Here is my code!
public String month()
{
int month = 0;
switch(month){
case 1 :monthString = " Janauri";
break;
case 2: monthString = "February"
.......
ublic String dateOfTomorrow(int day, int month, int year)
{
String Date = day+ "-" + month+ "- " + year;
day++;
if(day > totalDaysInMonth(month));
{// new month
day = 1;
month++;
if(month > 12)
{//new year
month= 1;
year ++;
}
}
return Date;
}
private boolean totalDaysInMonth(int day)
{
if( day >= 1 && day < 31)
{
return true;
}
else {
return false;
}
}
public void actionPerformed(ActionEvent e)
{
for ( int i = 1; i<31;);
String s = tf.getText();
if ( e.getSource() == b1)
{
l2.setText(s);
}
else if (e.getSource ()== b2)
{
l2.setText(monthString);
}
}