Question: Write a Java program that uses two classes (a Date class and a DateDriver class) to display a date to the screen. You must
Write a Java program that uses two classes (a Date class and a DateDriver class) to display a date to the screen. You must write two classes using two separate files for full credit. Requirements Fields: Constructor: One 3-argument constructor Methods: Method: for the Date Class 1. integer to store the month 2. integer to store the day 3. integer to store the year Be sure to use the appropriate access modifier for each field. Purpose: Access: Parameter: Return value: Algorithm: The constructor uses three integer arguments representing the month, day, and year values. Use each argument to call the appropriate setter method. Getter and setter for each field listed above displayDate() Prints the date in the mm/dd/yyyy format public None None Use the fields to display the date to the screen using the format mm/dd/yyyy. Requirements for the DateDriver Class Fields: None Method: main() Algorithm: 1. Instantiate an object of type Date, passing any three integers to the constructor. Use integers that form a valid date. 2. Call the displayDate method of the Date object to display this date to the screen. 3. Prompt the user for three new integer values. Be sure to use prompts that explain what the user needs to do. 4. Call the appropriate setter methods of the Date object, using the three values input by the user. 5. Call the displayDate method of the Date object to display the new date to the screen. Sample Run Date is 8/28/2022 New month: 9 New day: 5 New year: 2022 Date is 9/5/2022
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
