gn and i mp. the đày ôf 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. а. b. Print the day. Return the day. c. 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.

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 3PE: Chapter 10 defined the class circleType to implement the basic properties of a circle. (Add the...
icon
Related questions
Question
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.
Return the day.
c.
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.
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.
Code for dayType class:
class dayType
{
public:
static string weekDays[7];
void print() const;
string nextDay) const;
string prevDay() const;
void addDay(int nDays);
void setDay(string d);
string getDay() const;
dayType();
dayType(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. Return the day. c. 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. 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. Code for dayType class: class dayType { public: static string weekDays[7]; void print() const; string nextDay) const; string prevDay() const; void addDay(int nDays); void setDay(string d); string getDay() const; dayType(); dayType(string d); private: string weekDay; };
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
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
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:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT