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 15:30
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
Overload the + operator as indicated. Sample output for the given program:
First vacation: Days: 7,...
Biology, 09.12.2019 11:31
Mathematics, 09.12.2019 11:31
Mathematics, 09.12.2019 11:31
Business, 09.12.2019 11:31
Biology, 09.12.2019 11:31
Chemistry, 09.12.2019 11:31
Biology, 09.12.2019 11:31
Mathematics, 09.12.2019 11:31
Social Studies, 09.12.2019 12:31
Mathematics, 09.12.2019 12:31
Chemistry, 09.12.2019 12:31
Social Studies, 09.12.2019 12:31
English, 09.12.2019 12:31