Computer Science, asked by DEMISESHAN, 1 year ago

Program to input number of weeks day 1 -7 and translate to its equivalent name of the day of the week example 1 to Sunday, 2 To S Monday ........ ,7 to Saturday.

Answers

Answered by stylishtamilachee
13

Answer:

public class Days

{

public void Weekday(int dow)

{

String ans ;

switch (dow)

{

case 1 : ans = "Sunday" ; break ;

case 2 : ans = "Monday" ; break ;

case 3 : ans = "Tuesday" ; break ;

case 4 : ans = "Wednesday" ; break ;

case 5 : ans = "Thursday" ; break ;

case 6 : ans = "Friday" ; break ;

case 7 : ans = "Saturday" ; break ;

default : ans = "Wrong day number" ;

}

System.out.print("Day no. " + dow + "is" + ans) ;

}

}

Example Output :

Day no. 6 is Friday

Similar questions