Computers and Technology, 15.08.2020 18:01 rsimmons696
Overload the + operator as indicated. Sample output for the given program:
First vacation: Days: 7, People: 3
Second vacation: Days: 12, People: 3
#include
using namespace std;
class FamilyVacation{
public:
void SetNumDays(int dayCount);
void SetNumPeople(int peopleCount);
void Print() const;
FamilyVacation operator+(int moreDays);
private:
int numDays;
int numPeople;
};
void FamilyVacation::SetNumDays(int dayCount) {
numDays = dayCount;
return;
}
void FamilyVacation::SetNumPeople(int peopleCount) {
numPeople = peopleCount;
return;
}
// FIXME: Overload + operator so can write newVacation = oldVacation + 5,
// which adds 5 to numDays, while just copying numPeople.
/* Your solution goes here */
void FamilyVacation::Print() const {
cout << "Days: " << numDays << ", People: " << numPeople << endl;
return;
}
int main() {
FamilyVacation firstVacation;
FamilyVacation secondVacation;
cout << "First vacation: ";
firstVacation. SetNumDays(7);
firstVacation. SetNumPeople(3);
firstVacation. Print();
cout << "Second vacation: ";
secondVacation = firstVacation + 5;
secondVacation. Print();
return 0;
}
Answers: 1
Computers and Technology, 22.06.2019 20:00
When you mouse over and click to add a search term this(these) boolean operator(s) is(are) not implied. (select all that apply)?
Answers: 1
Computers and Technology, 22.06.2019 23:30
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
Computers and Technology, 25.06.2019 04:30
If you have watched pretty little liars(pll)what are the names of the main characters? all of them and the boyfriends and girlfriends too.
Answers: 2
Computers and Technology, 25.06.2019 08:00
Ais the hardware where the data is actually stored.
Answers: 1
Overload the + operator as indicated. Sample output for the given program:
First vacation: Days: 7,...
Health, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
English, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
English, 02.08.2019 21:00
History, 02.08.2019 21:00
Biology, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
Health, 02.08.2019 21:00
Geography, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
Mathematics, 02.08.2019 21:00
History, 02.08.2019 21:00