Write a program that contains a class that implements the days of the week. The program should be able to perform the following on an object of the class.
Set the day - Print the day to the computer monitor (not the printer)
Return the day
We will use this same basic program next week to add additional operations and incorporate additional object oriented concepts.
Output
Below is a sample output.
The Value of the Monday Object is Mon.
The Value of the Tuesday Object is Tues.
Remember, this is a suggested output posted to help you determine what
your program output should look like. Feel free to change it in any way you want. SURPRISE ME!
Deliverables
L A B S T E P S
STEP 1: Create the Project and Main Class
Create a new console application project and name it "Week1Lab_YourName".
Create a new class called DayOfTheWeek. The class should have a data member that can store the day of the week such as Mon for Monday, Tues for Tuesday etc...
STEP 2: Create the member functions
Create the necessary member functions that will perform the required operations outlined in the lab summary above. Call these functions setDay, printDay and getDay.
STEP 3: Create a main() program Write a main program that will instantiate two objects of the class DayOfTheWeek. Use these objects to test the various operations on this class. Use the examples provided in the lectures and in the reading to help you perform the required operations.
"this is what i have come up with thus far. I don't know where to begin, how to start, or what to do...."
// Uche Ehiem Week 1 iLab.cpp : Defines the entry point for the console application.
//
First I would recommend turning your member variable to a string (which would require #include <string> )
Then start with the member functions.
in setDay all you're doing is setting the day. And you passed a string literal to the function. So, in that funtion you would just set DayOfWeek to what you passed to the function (string a). Since you aren't asking the user for the day (yet) you don't need to have predefined arrays with the weekdays. And the function title itself says that all you're doing is setting the member variable DayOfWeek to what was passed to it.
then in getDate, you would just return DayOfWeek. This is because your member variable is private and it allows you to access that information in the main function.
in print date, you would just cout << DayOfWeek; again, this is just letting you access the private information you set with setDate.
your string doesn't have a name. You need to declare it in your function header. And why is it referenced? You made the function a const, so you're not going to be able to change the value you passed it. I would make this function with no formal parameters.