C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Concept explainers

bartleby

Videos

Question
100%
Book Icon
Chapter 11.4, Problem 2E

a)

Program Plan Intro

Program Plan:

  • The function will be named as convert and called using the scope resolution operator:: from class date.
  • It will return the following expression.
this->year*10000+this->month*100+this->day;

Program Description: To define the function convert() for converting the date from dd/mm/yyyy format to yyyymmdd format.

b)

Program Plan Intro

Program Plan:

  • Include header files and declare the required namespaces.
  • Initialize the main function.
  • Prompt the user to enter the month year and day data members.
  • Call the function convert to return the long integer in the form yyyymmdd that is calculated by using the algorithm.

Program Description: The purpose of the program is to return the date in the form of yyyymmdd after taking month, year and day as input.

Blurred answer
Students have asked these similar questions
(Enhanced Employee Class) Modify class Employee inFigs. 12.9–12.10 by adding a private utility function calledisValidSocialSecurityNumber . This member function shouldvalidate the format of a social security number (e.g., ###-##-#### , where # is a digit). If the format is valid, return true ;otherwise return false .
(C++) 23. True/False: function getGallons() is an inline member function     24. Design a class called Date.  The class should store a date in three private integers: month, day, year.  There should be a member function to print out the date in the month/day/year format, e.g. 12/25/2015, 4/1/1970 There should be a constructor which takes three parameters to initialize the date.  It should not accept values for day greater than 31 or less than 1, or values for month greater than 12 or less than 1.  If the constructor is called with these values an error message should be printed out and the field set to 0.  Any value for year is acceptable. There do not need to be any other member functions. Provide the class declaration and also the implementation of the member function and constructor.
(Rectangle Class) Create a class Rectangle with attributes length and width, each of whichdefaults to 1. Provide member functions that calculate the perimeter and the area of the rectangle.Also, provide set and get functions for the length and width attributes. The set functions should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY