Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 135,939 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,713 people online right now. Registration is fast and FREE... Join Now!




Can someone please help me its important I get this done today

 
Reply to this topicStart new topic

Can someone please help me its important I get this done today

spooky3333
11 May, 2008 - 01:13 PM
Post #1

New D.I.C Head
*

Joined: 11 May, 2008
Posts: 10

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
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 08:39AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month