Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write this in C++ and useable in Visual Studio 16.15 (Date Class) Create a class called Date that includes three pieces of information as

image text in transcribedimage text in transcribed

Please write this in C++ and useable in Visual Studio

16.15 (Date Class) Create a class called Date that includes three pieces of information as data membersa month (type int), a day (type int) and a year (type int). Your class should have a con- structor with three parameters that uses the parameters to initialize the three data members. For the purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that the month value is in the range 112; if it isn't, set the month to 1. Provide a set and a get func- tion for each data member. Provide a member function displayDate that displays the month, day and year separated by forward slashes (/). Write a test program that demonstrates class Date's capa- bilities. 1. [3 points] Do Exercise # 16.15 on page 625 of the textbook C How to Program. You must not have any public data members in your class. 2. [3 points] Add, to your program, a class called Time1960 that is used to track time of day in hours (0 to 23), minutes (0 to 59), and seconds (0 to 59). Use this class in your program and prompt the user to enter time of the day. Your program displays the entered time in the format HH:MM:SS (hours, minutes and seconds). You must not have any public data members in your class. 3. [4 points] Using the classes created in parts 1 and 2 (above), enhance your program to: a. Prompt the user for two date-time pairs (that is a date and time for the first pair and a date and time for the second pair). Display the two entered values in the format month/day/year HH:MM:SS. b. Display the total number of seconds between the two date-time values. 16.15 (Date Class) Create a class called Date that includes three pieces of information as data membersa month (type int), a day (type int) and a year (type int). Your class should have a con- structor with three parameters that uses the parameters to initialize the three data members. For the purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that the month value is in the range 112; if it isn't, set the month to 1. Provide a set and a get func- tion for each data member. Provide a member function displayDate that displays the month, day and year separated by forward slashes (/). Write a test program that demonstrates class Date's capa- bilities. 1. [3 points] Do Exercise # 16.15 on page 625 of the textbook C How to Program. You must not have any public data members in your class. 2. [3 points] Add, to your program, a class called Time1960 that is used to track time of day in hours (0 to 23), minutes (0 to 59), and seconds (0 to 59). Use this class in your program and prompt the user to enter time of the day. Your program displays the entered time in the format HH:MM:SS (hours, minutes and seconds). You must not have any public data members in your class. 3. [4 points] Using the classes created in parts 1 and 2 (above), enhance your program to: a. Prompt the user for two date-time pairs (that is a date and time for the first pair and a date and time for the second pair). Display the two entered values in the format month/day/year HH:MM:SS. b. Display the total number of seconds between the two date-time values

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

=+such as the dirigenti in Italy?

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago