reate a class called Date212 to represent a date. It will store the year, month and day as integers so you will need three private instance variables. One constructor should be provided that takes a String representing the date in yyyymmdd format. The constructor should use the substring method of class String to pull out the month, day and year, parse them as integers put them in the instance variables. The Date212 class should have the usual set and get methods, and equals, compareTo and toString methods. The toString method should print the date in “mm dd, yyyy” format (for example, 20211002 would be returned as “October 2, 2021”.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
100%

Create a class called Date212 to represent a date. It will store the year, month and day as integers so you will need three private instance variables. One constructor should be provided that takes a String representing the date in yyyymmdd format. The constructor should use the substring method of class String to pull out the month, day and year, parse them as integers put them in the instance variables. The Date212 class should have the usual set and get methods, and equals, compareTo and toString methods. The toString method should print the date in “mm dd, yyyy” format (for example, 20211002 would be returned as “October 2, 2021”.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT