Tuesday, February 18

Finding Day program in java



Hi ALL,

Here I wrote a program for simple Finding Day program in java.




/**
 *
 * @author Balamurgan M
 */

import java.util.Scanner;
import java.util.Date;
public class day_find {
    public static void main(String arg[]){
        int rday;
        int day;
        System.out.println("enter remaining days to meet your friend \t");
        Scanner in=new Scanner(System.in);
        rday=in.nextInt();
        Date d=new Date();
       // System.out.println("date "+d.getDay());
        int today = d.getDay();
       // System.out.println("taday "+today);
        day=(rday+today)%7;
        switch(day){
            case 0:
                System.out.println("Sunday");
                break;
            case 1:
                System.out.println("Monday");
                break;
            case 2:
                System.out.println("Tuesday");
                break;
            case 3:
                System.out.println("Wendesday");
                break;
            case 4:
                System.out.println("Thusday");
                break;
            case 5:
                System.out.println("Friday");
                break;
            case 6:
                System.out.println("Saturday");
                break;
            default:
                System.out.println("Wrong input");
        }
      
    }
   
}

No comments:

Post a Comment

Backup files to google drive using PHP coding

 Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...