Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, such as Sun for Sunday. The program should be able to perform the following operations on an object of type đdayType: Set the day. a. b. Print the day. c. Return the day. d. Return the next day. Return the previous day. e. Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add 4 days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday. f. g. Add the appropriate constructors. Write the definitions of the functions to implement the operations for the class dayType as defined in Programming Exercise 5. Also, write a program to test various operations on this class.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

C++

Test Review

Design and implement a class dayType that implements the day of the
week in a program. The class dayType should store the day, such as Sun
for Sunday. The program should be able to perform the following operations
on an object of type dayType:
Set the day.
a.
b.
Print the day.
c.
Return the day.
d.
Return the next day.
Return the previous day.
е.
Calculate and return the day by adding certain days to the current day.
For example, if the current day is Monday and we add 4 days, the day to
be returned is Friday. Similarly, if today is Tuesday and we add 13 days,
the day to be returned is Monday.
Add the appropriate constructors.
f.
g.
Write the definitions of the functions to implement the operations for the
class dayType as defined in Programming Exercise 5. Also, write
program to test various operations on this class.
a
Code for dayType class:
class dayType
{
public:
static string weekDays[7];
void print() const;
string nextDavl) const;
string prevRavl) const;
void addDaylint nDavs);
void setDay(string d);
string getDayl) const;
davTvpel);
davTYpe(string d);
private:
string weekDay;
};
Transcribed Image Text:Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, such as Sun for Sunday. The program should be able to perform the following operations on an object of type dayType: Set the day. a. b. Print the day. c. Return the day. d. Return the next day. Return the previous day. е. Calculate and return the day by adding certain days to the current day. For example, if the current day is Monday and we add 4 days, the day to be returned is Friday. Similarly, if today is Tuesday and we add 13 days, the day to be returned is Monday. Add the appropriate constructors. f. g. Write the definitions of the functions to implement the operations for the class dayType as defined in Programming Exercise 5. Also, write program to test various operations on this class. a Code for dayType class: class dayType { public: static string weekDays[7]; void print() const; string nextDavl) const; string prevRavl) const; void addDaylint nDavs); void setDay(string d); string getDayl) const; davTvpel); davTYpe(string d); private: string weekDay; };
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Function Arguments
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education