Devam Ediyor

498591 add days of the week

I have an assignment due today and I'm so rusty at programming and had a week from hell, that i havent even had time to read the new chapter and get started on my lab. I need help asap. here's what i need:

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.

1. Set the day.

2. Print the day.

3. Return the day.

4. Return the next day.

5. Return the previous day.

6. Calculate and return the day by adding a certain amount of days to the current day. For example, if you add five days to Saturday, the day to be returned is Thursday. Likewise, if we add 12 days to Wednesday, the day returned will be Monday.

1. Expand the member functions of iLab 1 to allow for the additional operations outlined in the lab summary above.

2. Call the additional functions, plusOneDay(), minusOneDay(), and addDays().

Function plusOneDay() returns the next day.

Function minusOneDay() returns the previous day.

Function addDays() will take the number of additional days as a parameter and calculate and return a new day name by adding a certain amount of days to the current day.

This is what i have from my previous assignment:

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

};

string DayOfTheWeek::getDay() const

{

return day;

}

void DayOfTheWeek::setDay(string newDay)

{

day = newDay;

}

void DayOfTheWeek::printDay() const

{

cout << day;

}

void DayOfTheWeek::plusOneDay()

{

}

int main()

{

DayOfTheWeek monday;

DayOfTheWeek tuesday;

// Set the values of the objects

[url removed, login to view]("Monday");

[url removed, login to view]("Tuesday");

// Get the monday object and print it out

string currentDay = [url removed, login to view]();

cout << "The value of the object is " << currentDay << ". This object wishes it was Sunday!" << endl;

// Print the tuesday object

cout << "The value of the object is ";

[url removed, login to view]();

cout << ". This object is just glad it's not Monday!" << endl;

return 0;

}

Beceriler: Her şey Kabul, PHP

Daha fazlasını görün: what was the, what is a string in programming, what is an object in programming, string the, string is not a member of std, programming what is a class, need help programming assignment, implements set, c programming string functions, value stores, std, endl, add number, due week, additional functions, day week monday, add print, day number week, week ilab, monday week, program set day week, monday week number, implements day week program, tuesday chapter, week lab

İşveren Hakkında:
( 5 değerlendirme ) no where, United States

Proje NO: #2244511

Seçilen:

edogsl

thanks so much~!

0 gün içinde 18$ USD
(10 Değerlendirme)
3.8