Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions In visual studio C++, Design and implement a class dayType that implements the day of the week in a program. The class dayType should

Instructions

In visual studio C++, Design and implement a class dayType that implements the day of the week in a program. The class dayType should store a day of the week, such as Sun for Sunday, Mon for Monday, etc. The program should be able to perform the following operations on an object of type dayType:

a. Set the day.

b. Print the day.

c. Return the day.

d. Return the next day.

e. Return the previous day.

f. 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.

g. Add the appropriate constructors.

g.1. No argument constructor.

g.2. Constructor with an integer input argument which initializes the day of the week.

g.3. Constructor with a string input argument which initializes the day of the week.

h. Add the appropriate destructor (which prints "dayType object destroyed").

Notes

Inside the class, store the day of the week as a number (0..6) where 0 is Monday and 6 is Sunday. Initialize the day of the week as 0 with an inline initialization.

When returning the day of the week, previous, or next; return a String such as Mon, Tue, Wed, Thu, Fri, Sat, Sun.

In the main

Create a dayType object and set a day of the week. Print this day of the week.

Create a second dayType object and copy the data from the first dayType object (e.g. obj2=obj1). Then, print the previous day.

Create a third dayType object and copy the data from the first dayType object. Then, print the next day.

Create a fourth dayType object and copy the data from the first dayType object. Then, return the day of the week after adding 11 days to the current day.

image text in transcribed

Files to submit

  • dayType.h, dayType.cpp
  • main program (.cpp)
Example of expected output In the example below the first dayType object was defined as Monday. You can use a different day if you want. First object: Monday Previous day: Sunday Next day: Tuesday After 11 days: Friday

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_2

Step: 3

blur-text-image_3

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions