sum and averrage

Project A

Define a class called DayOfWeek that is an abstract data type for a day in the week. Your class will have one member variable of type int to represent a day (1 for Monday, 2 for Tuesday, and so forth). Follow the ADT (Abstract Data Type) guideline to implement this class.

Include at least the following member functions:
// constructors

1. a constructor to set the day using the first three letters (e.g. “MON” for Monday)
2. a constructor to set the day using an integer as an argument (e.g. 1 for Monday)
3. a default constructor

// input function

4. an input function that reads the day as the first three letters, accepts an input stream as parameter

// output function

5. an output function that outputs the day as an integer, accepts an output stream as parameter

// others

6. a member function that returns the next day as a value of type DayOfWeek.

Test each member functions in the DayOfWeek class to make sure they are functioning properly before moving onto project B.

Project B

Write a program based on the DayOfWeek class in project A so that it:

  1. Accepts a 3-letter input from the user as the week of day (using member function #4 described above)
  2. Outputs the current day number, following by the next 6 days’ (using member function #5 & #6 described above)

Requirements

1. Follow the ADT (Abstract Data Type) guideline to implement the required class

2. Comment well in your program and any functions you use

Demo

Please enter three letters for the day of week: (e.g. MON for Monday)

wed

This is day 3 of the week.

This is day 4 of the week.

This is day 5 of the week.

This is day 6 of the week.

This is day 7 of the week.

This is day 1 of the week.

This is day 2 of the week.