Question: JAVA(NO IF STATEMENTS OR LOOPS) Create a class named Date in a new Java file, and Implement the following methods. Task1: Create a private variable

JAVA(NO IF STATEMENTS OR LOOPS)

Create a class named Date in a new Java file, and Implement the following methods.

Task1: Create a private variable of string type, named date and default as an empty string. // Assume the input string for date is always in a format of MM-DD-YYYY

Task2: Create methods getter named getDate and setter named setDate for date.

Task3: Create methods getter named getMonth and setter named setMonth for month.

Task4: Create methods getter named getDay and setter named setDay for day.

Task5: Create methods getter named getYear and setter named setYear for year.

Task6: Create methods named getDifferent, which takes a class Date, and return the integer of total difference of days between them. (Assume that every year has 365 days, and every month has 30 days. For example,

Compare Two date from two class Date 01-02-1998 and 01-03-1998, return 1, 02-01-1998 and 3-1-1998, return 30, 2-1-1998 and 2-1-2020, return 365, 2-1-2020 and 2-1-2000, return 7300.

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!