C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 9, Problem 9.8E
Program Plan Intro

Program Plan:

  • Include the required header files.
  • Create class Date.
  • The class definition will contain prototypes for member function Date like setDate.
  • The private integer members month, day and year.
  • A member function nextDay is included to increment the day by one.

Program Description:

/*Program that tests function nextDay in a loop which prints the date during each iteration.*/

Date class declaration

Here, the class is Date which declares the functions setDate()and nextDay().

Blurred answer
Students have asked these similar questions
(Enhancing Class Time) Modify the Time class of Figs. 17.4–17.5 to include a tick memberfunction that increments the time stored in a Time object by one second. Write a program that teststhe tick member function in a loop that prints the time in standard format during each iterationof the loop to illustrate that the tick member function works correctly. Be sure to test the followingcases:a) Incrementing into the next minute.b) Incrementing into the next hour.c) Incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).
Q2) (Perfect Numbers) An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a function perfect that determines if parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.
(Modifying Class GradeBook) Modify class GradeBook (Figs. 16.11–16.12) as follows:a) Include a second string data member that represents the course instructor’s name.b) Provide a set function to change the instructor’s name and a get function to retrieve it.c) Modify the constructor to specify course name and instructor name parameters.d) Modify function displayMessage to output the welcome message and course name,then the string "This course is presented by: " followed by the instructor’s name.Use your modified class in a test program that demonstrates the class’s new capabilities.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning