Share
Explore BrainMass

Java Creating a Class Called Date

Create a class called SimpleDate that includes three instance variables - a month, a day and a year (all type int). Provide a constructor that initializes the three instance variables and validates that those values are correct (follow calendar rules) and throws an exception for incorrect values. Provide a set and get method for each instance variable. Provide a toString method override that displays the month, day and year separated by forward slashes (/).
Write a test application named SimpleDateTest that demonstrates class SimpleDate's capabilities

Solution Summary

This solution helps create a class called SimpleDate, which includes three instance variables (month, day and year). It also provides a constructor that initializes the three initializes three instance variables and validates that those values are correct. It also provides a set and get method for each instance variable and a toString method to override the display. In addition, a test application named SimpleDateTest demonstrating SimpleDate's capabilities is given.

$2.19