Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ANSWER in C# Create a class called Date that includes three pieces of information as class properties: i. Month (type int), ii. Day (type int)
ANSWER in C#
Create a class called Date that includes three pieces of information as class properties: i. Month (type int), ii. Day (type int) and iii. Year (type int). 1. Your class Date should have a constructor that initializes the three properties. 2. Implement three properties with appropriate set accessor to validate the values assigned to three properties as follows: i) Day property value should be 1 to 31, when Month property value is (1, 3, 5, 7, 8, 10, 12) ii) Day property value should be 1 to 30, when Month property value is (4, 6, 9, 11) iii) Day property value should be 1 to 29, when Month property value is 2 and Year property value a leap year, if Year property value is not a leap year then Day property value should be 1 to 28. If any property value is not a valid value, then an appropriate message should be displayed to inform the user about the invalid value and the property name. 3. Provide a method DisplayDate that displays the month, day and year separated by forward slashes (/), as show below. Current Date MM/DD/YYYY Write a test app named Date Test that demonstrates class Date's capabilities by a) displaying appropriate prompts (messages) for user to provide input values for three properties (Month, Day, and Year), and receive input values for three properties via keyboard, from the app user. b) calling class Date constructor to create object(s) and initialize three properties of the object by passing input values from step (a) as arguments to the constructor. c) calling DisplayDate method to display the Date class object value in a table as shown aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started