Question: DateDemo Class import java.util.Scanner; public class DateDemo { public static void main ( String [ ] args ) { Scanner in = new Scanner (

DateDemo Class
import java.util.Scanner;
public class DateDemo
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
// Prompt the user for the first day of class.
// Read a string in the format mm/dd/yyyy and parse the string into 3 integers
// representing the month, day and year.
System.out.print("Enter the first day of class ->");
String line = in.nextLine();
String[] nums = line.split("/");
int m1= Integer.parseInt(nums[0]);
int d1= Integer.parseInt(nums[1]);
int y1= Integer.parseInt(nums[2]);
// Do the same thing for the last day of class
...
// Construct two objects of the Date class for the first day of class
// and the last day of class.
...
// Call the setDate method on each of the two objects to set the values
// of their instance variables using the data that was entered.
...
// Call the getWeekDay method on each of the two objects to get the name of
// the weekday as a string and store it in a string variable.
...
// Call the getMonth method on each of the two objects to get the name of
// the month as a string and store it in a string variable.
...
// Print a blank line (System.out.println();) and then write two println
// statements to print the first day of class and the last day of class
// as shown in the output on the assgnment sheet. When you write the two
// println statements, use the string variables defined above for the name
// of the weekday and the name of the month, and call the getDay and getYear
// methods on the objects to get the day and year as integers.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!