Home /
Expert Answers /
Computer Science /
1-a-class-called-date-which-models-a-calendar-date-is-designed-as-shown-in-the-following-class-di-pa635
(Solved): 1. A class called Date, which models a calendar date, is
designed as shown in the following class di ...
1. A class called Date, which models a calendar date, is
designed as shown in the following class diagram. Write the Date
class and the test driver for the Date class.
Date -day: int -month: int -year: int +Date (day:int, month: int, year:int) +getDay(): int +get Month(): int +getYear(): int +setDay (day:int) : void +setMonth (month:int):void +set Year (year:int) : void +setDate(day:int, month: int, year: int):void +toString(): String day = [1, 31] month= [1, 12] year = [1900, 9999] No input validation needed. "dd/mm/yyyy" with leading zero
Code: public class Date { // initializing variables int day, month, year; // getters and setters public int getDay() { return day; } public void setDay(int day) { this.day = day