Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing these two classes in Java: MyCalendar.java : Will create a calendar as shown like below using JAVA 8 methods. MyCalendarTester.java :The tester

Need help writing these two classes in Java:

MyCalendar.java: Will create a calendar as shown like below using JAVA 8 methods.

image text in transcribedMyCalendarTester.java :The tester will print the calendar first and then It will read a file called events.txt and load the events into the calendar[using an ArrayList most likely] the events.txt file will look like this:

Interview at Amazon 9/28/19 9:30 11:30 Dentist appt 10/3/19 16:15 17:00 Course Committee Meeting F 18:30 20:30 1/25/19 5/13/19

After the events.txt file "Events" are loaded successfully into the program it will print a message saying "Load has been successful". After the message there should be a menu which has two things either [V]iew the list by selecting V in order of starting date and starting time as shown below:

2019 Friday March 15 13:15 - 14:00 Dentist Thursday April 25 15:00 - 16:00 Job Interview 2020 

or [Q]uit selecting Q to terminate the program.

------------------------------------------------

TIPS/EXAMPLES:

A) LocalDate c = .... DateTimeFormatter formatter = DateTimeFormatter.ofPattern("E, MMM d yyyy"); System.out.println(" " + formatter.format(c));

B)

/** * Example to show the manipulation of Date and Time information through * Java 8.0 API. * */ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Scanner; public class DateTimeExample { public static void main(String [] args) { LocalDate cal = LocalDate.now(); // capture today Scanner sc = new Scanner(System.in); System.out.print("Today: "); printCalendar(cal); while (sc.hasNextLine()) { String input = sc.nextLine(); if (input.equals("p")) { cal = cal.minusMonths(1); // LocalDateTime is immutable printCalendar(cal); } else if (input.equals("n")) { cal = cal.plusMonths(1); // LocalDateTime is immutable printCalendar(cal); } } System.out.println("Bye!"); } public static void printCalendar(LocalDate c) { System.out.print(c.getDayOfWeek()); System.out.print(" "); System.out.print(c.getDayOfMonth()); System.out.print(" "); System.out.println(c.getMonth()); // To print a calendar in a specified format. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("E, MMM d yyyy"); System.out.println(" " + formatter.format(c)); // To figure out the day of week of the 1st day of the given month LocalDate x = LocalDate.of(c.getYear(), c.getMonth(), 1); System.out.println(x.getDayOfWeek() + " is the day of " + c.getMonth() + " 1."); // enum value as it is System.out.println(x.getDayOfWeek().getValue() + " is an integer value corresponding " + " to " + x.getDayOfWeek()); // int value corresponding to the enum value } } 
March 2019 Su Mo Tu We Th Fr Sa 3 45 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [20] 21 22 23

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions