Last active
December 19, 2018 17:50
-
-
Save farhanpro/b7164171413e47e840ed37dd0940beee to your computer and use it in GitHub Desktop.
Written a method with the name printDayOfTheWeek that has one parameter of type int and name it day.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
public class Main { | |
public static void main(String[] args) { | |
DayOfTheWeek(1); | |
DayOfTheWeek(2); | |
DayOfTheWeek(3); | |
DayOfTheWeek(4); | |
DayOfTheWeek(5); | |
DayOfTheWeek(6); | |
DayOfTheWeek(7); | |
} | |
public static void DayOfTheWeek(int Day){ | |
switch (Day){ | |
case 1: | |
System.out.println("Monday"); | |
break; | |
case 2: | |
System.out.println("Tuesday"); | |
break; | |
case 3: | |
System.out.println("Wednesday"); | |
break; | |
case 4: | |
System.out.println("Thursday"); | |
break; | |
case 5: | |
System.out.println("Friday"); | |
break; | |
case 6: | |
System.out.println("Saturday"); | |
break; | |
case 7: | |
System.out.println("Sunday"); | |
break; | |
default: | |
System.out.println ("Invalid input"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment