I need help with understanding the next steps I need to do in order to finish this project...here is the assignment--
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
Return the day
Return the next day
Return the previous day
Calculate and return the day by adding a certain amount of days to the current day. For example if you add 5 days to Saturday, the day to be returned is Thursday. Likewise, if we add 12 days to Wednesday, the the day returned will be Monday.
Im not sure what to do next...can anyone help?CODE
// d.cpp : main project file.
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class DayOfTheWeek
{
public:
void setDay(string );
// setDay(string) takes a string parameter
// and stores the value in the day attribute.
void printDay() const;
// printDay() prints the value of the day attribute
// on console output (cout).
string getDay() const;
// returns the value of the day attribute.
void plusOneDay();
void minusOneDay();
void addDays();
private:
string day; // This is where the value of the day attribute is stored.
static int dayArray[7];
};
string DayOfTheWeek::getDay() const { return day; }
void DayOfTheWeek::setDay(string newDay) { day = newDay; }
void DayOfTheWeek::printDay() const { cout << day; }
void DayOfTheWeek::plusOneDay(){}; // I put these brackets on the next 3 lines because I think this is where im stuck..
void DayOfTheWeek::minusOneDay(){};
void DayOfTheWeek::addDays(){};
int main(array<System::String ^> ^args)
{
DayOfTheWeek monday;
DayOfTheWeek tuesday;
// Set the values of the objects
monday.setDay("Mon");
tuesday.setDay("Tues");
// Get the value of the monday object and print it out
string currentDay = monday.getDay();
cout << "The value of the monday object is " << currentDay << "." << endl;
// Print out the value of the tuesday object
cout << "The value of the tuesday object is ";
tuesday.printDay();
cout << "." << endl;;
// We're finished
return 0;
}
This post has been edited by spooky3333: 11 May, 2008 - 03:49 PM