![leysirivera23ovez6n](/avatars/39210.jpg)
leysirivera23ovez6n
20.04.2020 •
Computers and Technology
Use C++ in the following.
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;
}
Solved
Show answers
More tips
- H Health and Medicine What is the Normal Blood Sugar Level in a Healthy Person?...
- D Dating, Love, Relationships How Long Can Love Last?...
- A Auto and Moto Mastering One-Movement Parking: All You Need to Know...
- C Computers and Internet How to Properly Order Clothing from International Online Stores...
- H Health and Medicine Headache: A Comprehensive Guide to Treatment...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- A Auto and Moto Discovering the Leader: What is the Most Expensive Car in the World?...
- F Food and Cooking How to Quickly Put your Child to Sleep?...
- C Computers and Internet How to Create a Website for Free and Easy?...
- F Family and Home Parquet or laminate, which is better?...
Answers on questions: Computers and Technology
- E English Can someone help me Diagraming Sentences: Elli and her brother will be staying home....
- S Social Studies Skye creates a tuneful song stringing together some terms she needs to learn for a geology quiz. since this song is designed to improve skye s memory for the material, it is a(n)...
- E English Write a letter to your friend asking to join in your birthday Party....
- M Mathematics Let s now see what the distribution of statistics is actually like under Emily s model. Define the function simulation_and_statistic to take in the model_proportions array and...
Ответ:
See explaination for program code
Explanation:
/* C++ Program that implements the + operator overloading */
#include <iostream>
using namespace std;
//Class definition
class FamilyVacation
{
public:
void SetNumDays(int dayCount);
void SetNumPeople(int peopleCount);
void Print() const;
FamilyVacation operator+(int moreDays);
private:
int numDays;
int numPeople;
};
//Class implementation
//Function that sets number of days
void FamilyVacation::SetNumDays(int dayCount)
{
numDays = dayCount;
}
//Function that sets number of people
void FamilyVacation::SetNumPeople(int peopleCount)
{
numPeople = peopleCount;
}
//Function that prints number of days and number of people
void FamilyVacation::Print() const
{
cout << " Days: " << numDays << ", People: " << numPeople;
}
//Overloading plus operator
FamilyVacation FamilyVacation::operator+(int moreDays)
{
//Adding moreDays to existing days
numDays = numDays + moreDays;
//Returning current object
return *this;
}
//Main function
void main()
{
//Creating first vacation object
FamilyVacation vacation1;
//Setting number of days to 7 of object vacation1
vacation1.SetNumDays(7);
//Setting number of people to 3 of object vacation1
vacation1.SetNumPeople(3);
//Printing vacation 1 object values
cout<<"\n First Vacation: ";
vacation1.Print();
//Adding extra 5 days to object vacation1
FamilyVacation vacation2 = vacation1 + 5;
//Printing vacation 2 object values
cout<<"\n Second Vacation: ";
vacation2.Print();
cout<<"\n\n";
}
kindly check attachment for output
Ответ:
Maintenance
Explanation:
The maintenance stage of an hardware life-cycle involves the servicing, repair replacement of machine component activities as well as other restorative activities meant to restore the machine to its original state.
The stages of an hardware life-cycle are;
1) Planning for the required hardware
2) Buying or leasing the hardware
3) Hardware installation
4) Maintenance activities, Repair
5) Hardware upgrading
6) Extend
7) Hardware trade in or buyback
8) Disposal of the hardware