In JAVA
Write a program that takes an integer between 1 and 12 inclusive, and a String of three letters (representing the day of the week) from the user, and prints a calendar for the month of the year represented by the integer. For example, if the user enters 1 and "Mon", the program should print the calendar for January, starting the first day of the month on Monday.
Enter the month (1 - 12): 1
Which day of the week is the first day of the month (Mon, Tue, etc.): Mon
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
.
Specific requirements include the following.
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
int i,month,x=0,ct;
int[] months=new
int[31];
String day,str;
String[] days = new
String[7];
days[0] = "sun";
days[1] = "mon";
days[2] = "tue";
days[3] = "wed";
days[4] = "thu";
days[5] = "fri";
days[6] = "sat";
Scanner in = new
Scanner(System.in);
System.out.println("Enter Month ,
Day:");
month= in.nextInt();
day= in.nextLine();
for(i=0;i<7;i++){
str=days[i];
if(str
== day)
x=i;
}
for(i=0;i<7;i++)
System.out.print(days[i]+"\t");
System.out.println("");
for(i=0;i<x;i++)
System.out.print("\t");
ct=x;
if(month==1 || month==3
|| month==5 || month==7 || month==8 || month==10 ||
month==12)
x=31;
else if(month==2)
x=28;
else
x=30;
for(i=0;i<x;i++){
System.out.print(" "+(i+1)+"\t");
ct++;
if(ct%7==0){
System.out.println("");
continue;
}
}
}
}
output:-



In JAVA Write a program that takes an integer between 1 and 12 inclusive, and a...