Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class called calender. The class has four data members, the month name,

ID: 644063 • Letter: W

Question

Write a class called calender. The class has four data members, the month name, the day on which the month starts, and the number of days in that month and the year.
              
               Write a program that instantiate an instance of that class and print a calendar based on the given month and year. EAch month has different starting day, so make sure you ask the user on what day the month starts and print the calendar for that month starting on that day.
              
               The class should include constructors, getters and setters for each of the data members. The clas should have a method to read the information from the user and another method to print the month. Assume February is always 28 days.
     

Should look like Sample out below:

Write a class called calender. The class has four data members, the month name, the day on which the month starts, and the number of days in that month and the year. Write a program that instantiate an instance of that class and print a calendar based on the given month and year. EAch month has different starting day, so make sure you ask the user on what day the month starts and print the calendar for that month starting on that day. The class should include constructors, getters and setters for each of the data members. The clas should have a method to read the information from the user and another method to print the month. Assume February is always 28 days. SAMPLE OUTPUT: getters and setters for each of the data members. The class should ha to read the information from the user and another method to print the month. Assume February is always 28 An example of the output will look like this: look like this: Enter the name of the month you want to print: February Enter the year: 2014 Enter the day on which the month starts (use theta for Sunday, 1 for Monday, ...etc.) : 2

Explanation / Answer

import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class CalendarDateExample { public static void main(String[] args) { // Create an instance of a GregorianCalendar Calendar calendar = new GregorianCalendar(2014, 1, 06); System.out.println("Year: " + calendar.get(Calendar.YEAR)); System.out.println("Month: " + (calendar.get(Calendar.MONTH) + 1)); System.out.println("Day: " + calendar.get(Calendar.DAY_OF_MONTH)); // Format the output. SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd"); System.out.println(date_format.format(calendar.getTime())); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote