1answer.
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
sladkih [1.3K]
3 years ago
12

BOTH QUESTIONS ONLY FILL IN C++ CODEWrite a copy constructor for CarCounter that assigns origCarCounter.carCount to the construc

ted object's carCount. Sample output for the given program:Cars counted: 5Sample program:#include using namespace std;class CarCounter { public: CarCounter(); CarCounter(const CarCounter& origCarCounter); void SetCarCount(const int count) { carCount = count; } int GetCarCount() const { return carCount; } private: int carCount;};CarCounter::CarCounter() { carCount = 0; return;}// FIXME add copy constructorvoid CountPrinter(CarCounter carCntr) { cout << "Cars counted: " << carCntr.GetCarCount(); return;}int main() { CarCounter parkingLot; parkingLot.SetCarCount(5); CountPrinter(parkingLot); return 0;}QUESTION #2!!!!!!!!!!!!!!!!_______________----------------------------------------------_______________________________Overload the + operator as indicated. Sample output for the given program:First vacation: Days: 7, People: 3Second vacation: Days: 12, People: 3Sample program:#include using namespace std;class FamilyVacation{ public: void SetNumDays(int dayCount); void SetNumPeople(int peopleCount); void Print() const; FamilyVacation operator+(int moreDays) const; 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. 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;}
Computers and Technology
1 answer:
Alborosie3 years ago
4 0

Answer:

im lost tell me a question then ill answer

Explanation:

You might be interested in
What general strategies can the network managers use to reduce congestions?
Harrizon [31]

Answer:

 There are different types of strategies that can be used by the network manager for reducing the congestion are as follows:

  • By monitoring the traffic of the network properly we can easily reduce the congestion in the network.
  • By segmenting the network properly, it helps to reduce the network congestion.
  • We can also reconfiguring the TCP/IP (Transmission control protocol) setting on the network.
  • We can also use the backpressure routing technique.

7 0
3 years ago
One problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example
riadik2000 [5.3K]

Answer:

Un problema con las matrices dinámicas es que una vez que se crea la matriz utilizando el nuevo operador, no se puede cambiar el tamaño. Por ejemplo, es posible que desee agregar o eliminar entradas de la matriz de manera similar al comportamiento de un vector. Este proyecto le pide que cree una clase llamada DynamicStringArray que incluye funciones miembro que le permiten emular el comportamiento de un vector de cadenas.

La clase debe tener:

Una variable miembro privada llamada dynamicArray que hace referencia a una matriz dinámica de tipo cadena.

Una variable de miembro privada llamada tamaño que contiene el número de entradas en la matriz.

Un constructor predeterminado que establece la matriz dinámica en NULL y establece el tamaño en 0.

Una función que devuelve el tamaño.

Una función llamada addEntry que toma una cadena como entrada. La función debe crear una nueva matriz dinámica un elemento más grande que dynamicArray, copiar todos los elementos de dynamicArray en la nueva matriz, agregar la nueva cadena al final de la nueva matriz, incrementar el tamaño, eliminar el antiguo dynamicArray y luego establecer dynamicArray en el nueva matriz.

Una función llamada deleteEntry que toma una cadena como entrada. La función debe buscar la cadena en dynamicArray. Si no lo encuentra, devuelva falso. Si lo encuentra, cree una nueva matriz dinámica con un elemento más pequeño que dynamicArray. Copie todos los elementos excepto la cadena de entrada en la nueva matriz, elimine DynamicArray, reduzca el tamaño y devuelva verdadero.

Una función llamada getEntry que toma un número entero como entrada y devuelve la cadena en ese índice en dynamicArray. Devuelve la cadena "" si el índice está fuera de los límites de dynamicArray.

Sobrecargue el operador [] para que pueda obtener y cambiar un elemento por un índice entero. Si el índice está fuera de los límites, devuelve una cadena "".

Un constructor de copia que hace una copia de la matriz dinámica del objeto de entrada.

Sobrecargue el operador de asignación para que la matriz dinámica se copie correctamente en el objeto de destino.

Un destructor que libera la memoria asignada a la matriz dinámica.

Cree un programa de prueba adecuado para evaluar su clase.

Debería nombrar el proyecto ASG10. Al comprimir la carpeta del proyecto, ASG10, incluya todos los archivos (.sln, .cpp, etc.) y subdirectorios (Debug, etc.).

************************************************

Copie su DynamicStringArray de la Tarea 10. Corrija el programa para que las 13 pruebas funcionen correctamente. Modifique la definición del operador sobrecargado [] y getEntry para que generen una excepción OutOfRange si se usa un índice que está fuera de rango. OutOfRange es una clase de excepción que define. La clase de excepción debe tener un miembro int privado y un miembro string privado, y un constructor público que tenga argumentos int y string. El valor del índice infractor junto con un mensaje deben almacenarse en el objeto de excepción. Tú eliges el mensaje para describir la situación. Modifique su programa de prueba y agregue pruebas que detecten la nueva clase de excepción.

Deberías nombrar

Explanation:

3 0
3 years ago
A slide _____ is a special animation effect used to progress from one slide to the next slide in a slide show.
Nutka1998 [239]
A slide *transition* is the word you're looking for, well I mean, if you're using powerpoint it is.
8 0
3 years ago
Read 2 more answers
Jabari created new video game for his coding course. What is one way he should format his pseudocode?
AleksAgata [21]

Answer:

Last one is the only logical one.

Explanation:

Hope this helps!!!

8 0
3 years ago
What laws are broken when you hack someone?
postnew [5]

Answer:

it depends

Explanation:

if you are hacking for a purpose that is benefiting the person being hacked, that is ethical hacking. ethical hacking is not illegal, as long as you get permission from the person being hacked.

if you hack someone without their knowledge, that is unethical hacking, and that is in many cases, a crime, and if it has enough of a detrimental effect on a companys process, it could land you into prison and earn you a hefty fine.

ethical hacking is good for testing a networks security, and if all is well, the ethical hacker shouldnt be able to get into a network if it is secured properly.

6 0
3 years ago
Other questions:
  • Larry recently viewed an auction listing on a website. as a result, his computer executed code that popped up a window that aske
    6·1 answer
  • What key stage involves considering design options?
    12·1 answer
  • Unit testing:_________. A. provides the final certification that the system is ready to be used in a production setting. B. incl
    8·1 answer
  • When information about a person remains on the internet indefinitely it is known as?
    6·1 answer
  • A JOB LEADS SOURCE LIST is used to help record all of the job leads you can find. It includes contact information and a plan for
    8·1 answer
  • Consider the following C code fragment:
    10·1 answer
  • Rachel wants to post content from digital cameras on the web. Which online tool will help Rachel to post and edit content on a w
    5·1 answer
  • Josephine is in the process of creating ads within her Standard Display campaign. She finds that there are two main ad formats t
    5·1 answer
  • Which is the correct process for opening a blank spreadsheet?
    7·1 answer
  • Kenny is asked to submit a photo for the annual photographic competition. He decided to capture a photo with the light-painting
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!