answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
yarga [219]
2 years ago
4

Use C++ in the following.

Computers and Technology
1 answer:
Neporo4naja [7]2 years ago
6 0

Answer:

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

You might be interested in
n the video, McWhorter says that “textspeak” might be a good thing for young people’s brains. Why does he think this?
ANEK [815]

As you may know people learn in different ways. Some learn by audio, hands on, and simply just reading. When he says textspeak it more than likely means the text will be read to you in a way you would understand better.

3 0
2 years ago
James has created some artwork portraying life on a different planet. He wants to show a world where everything is beautiful and
PIT_PIT [208]
What are the answer choices if so can you please post it with answer choices ?
5 0
2 years ago
Phillip is a wellness counselor. He has created a newsletter as a service for his clients. He needs to decide upon a method to d
Alexus [3.1K]
The best technology that Philip could use is the Email Newsletters.  <span> Sent on a regular basis, a content-based email newsletter not only helps you stay on top, but also showcases your updates concerning wellness,  C</span>reate a newsletter that will engage your users.  <span>Ensure that each content is educational, informative, and short but clear. </span>
3 0
2 years ago
The new Director of Information Technology has asked you to recommend a strategy to upgrade the servers on their network. Recomm
borishaifa [10]

Answer:

servers to be upgraded are : APPLICATION AND LOAD BALANCING SERVERS

servers still appropriate to use : DNS AND DHCP SERVERS

Explanation:

The recommendations to be made in line with what the new director of information is asking for includes :

1 ) For the servers to be upgraded : The servers that requires upgrades  includes the APPLICATION SERVER and LOAD BALANCING SERVER. this is because these two servers are critical to the growth/expansion of any business, and they handle large volume of data

Recommendations on the servers upgrade includes:

Hardware : 2.3 GHz Intel Xeon Gold 5118 12-Core

CPU chip set :  Socket: FCLGA3647, Type: NSBM

Speed : processor 3.2 GHz

caching:   > 100 Gb

2)  For servers that do not necessarily need to be upgraded : The servers that do not need immediate upgrade are DNS and DHCP

6 0
2 years ago
Many documents use a specific format for a person's name. Write a program whose input is: firstName middleName lastName and whos
goblinko [34]

Answer:

The solution code is written in Python:

  1. name = input("Enter your name: ")
  2. name_components = name.split(" ")
  3. first_name = name_components[0]
  4. middle_name = name_components[1]
  5. last_name = name_components[2]
  6. print(last_name + ", " + first_name[0] + "." + middle_name[0])

Explanation:

Firstly, prompt user to enter name (Line 1).

Next, use the string <em>split()</em> method and use space " " as separator to split the input string into individual component, first name, middle name, last name and assign to variable <em>first_name, middle_name </em>and<em> last_name </em>(Line 5-7).

Display the output as required by the question.

6 0
2 years ago
Other questions:
  • When ____ occur during preliminary debugging, dummy print statements—statements that are temporarily inserted into the code to d
    9·1 answer
  • George borrowed some equipment from his friend for recording his monologue for his art class. He got all the equipment except th
    15·1 answer
  • If Mark is developing a website to be optimized for mobile devices, what would be the top-level domain?
    10·1 answer
  • Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • The elements of an integer-valued array can be initialized so that a[i] == i in a recursive fashion as follows: An array of size
    10·1 answer
  • Which of the following operation is not performed by a mouse 1) left click , middle click , right click, double click​
    15·2 answers
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • Which of the following is not true of how computers represent complex information
    5·2 answers
  • Write a complete Java program that: Prompts an employee to enter the number of hours that they have worked in a given week and s
    14·1 answer
  • Docker is focused on ______ containerization.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!