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
umka2103 [35]
4 years ago
9

Write a destructor for the CarCounter class that outputs the following. End with newline.

Computers and Technology
1 answer:
ycow [4]4 years ago
7 0

Answer:

Following are the code to this question:

CarCounter::~CarCounter()//Defining destructor CarCounter

{

cout << "Destroying CarCounter\n";//print message Destroying CarCounter

}

Explanation:

Following are the full program to this question:

#include <iostream>//Defining header file

using namespace std;

class CarCounter //Defining class CarCounter

{

public:

CarCounter();//Defining constructor CarCounter

~CarCounter();//Defining destructor CarCounter

private:

int carCount;//Defining integer variable carCount

};

CarCounter::CarCounter()//declaring constructor  

{

carCount = 0;//assign value in carCount variable

return;//using return keyword

}

CarCounter::~CarCounter()//Defining destructor CarCounter

{

cout << "Destroying CarCounter\n";//print message Destroying CarCounter

}

int main() //Defining main method

{

CarCounter* parkingLot = new CarCounter();//Defining class object parkingLot

delete parkingLot;//

return 0;

}

  • In the given C++ language code, a class "CarCounter" is defined, and inside the class, a "constructor, Destructors, and an integer variable" is defined.  
  • Outside the class, the scope resolution operator is used to define the constructor and assign value "0" in the integer variable.  
  • In the above-given code, the scope resolution operator, to define destructor and inside this cout function is used, which prints a message.  
  • In the main method, the class object is created, which automatically calls its class constructor and destructors.  
You might be interested in
7.4 Code Practice: Question 2
Nuetrik [128]

def GPAcalc(grade, weighted):

   grade = grade.lower()

   dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}

   if weighted == 1 and grade in dictionary:

       return "Your GPA score is: "+str(dictionary[grade] + 1)

   elif weighted == 0 and grade in dictionary:

       return "Your GPA score is : "+str(dictionary[grade])

   else:

       return "Invalid"

print(GPAcalc(input("Input a letter grade: "), int(input("Is it weigthed? (1= yes, 0= no)"))))

I modified the code a bit to cut down on the use of if and elif statements. If you need me to change it, I will. Best of luck.

8 0
3 years ago
Before the 20th century how did most people experience computing​
frozen [14]

Answer:

   

Explanation:

3 0
3 years ago
Deonte, an engineer, has designed a specialized bicycle tire for a manufacturer. What industry does Dante work in?
yawa3891 [41]

Answer:

i think its number 4, because its only the tire itself

Explanation:

7 0
3 years ago
Frames control what displays on the Stage, while keyframes help to set up
pogonyaev

Answer: A keyframe is a location on a timeline which marks the beginning or end of a transition. So for example, you have a movie and it transitions to another scene, keyframes tell it when and where to start the transition then when and where to stop the transition.

3 0
3 years ago
Which of the following is not true about VOIP?
igomit [66]

Answer:

This question is incomplete. The complete question is given below:

Which of the following is not true about VOIP?

a) It stands for Voice Over Internet Possibility

b) It uses digital, not analog, signals.

c) It can transmit both voice and video.

d) It uses the Internet, rather than regular phone lines or your cellular network.

Option (a) is correct.

Explanation:

  • Option (a) is correct as VOIP doesn't stand for Voice Over Internet Possibility, rather it stands for Voice over Internet Protocol.
  • Option (b) is incorrect as it uses digital signals to transfer the information instead of analog signals.
  • Option (c) is incorrect as many VOIP based smartphone apps like Skype, Discord etc can be used to transmit both voice and video.
  • Option (d) is also incorrect as it uses internet as a medium to connect instead of regular phone lines or cellular network and that's why it is called Voice over Internet Protocol.
3 0
3 years ago
Other questions:
  • Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
    6·1 answer
  • Can someone please answer this for me I will answer one of yours.
    13·1 answer
  • In order to accomplish the same goal, a person can click and hold down the mouse button and drag to the right, or hold Shift and
    10·1 answer
  • Digital manufacturing has impacted our world today! List a reasons why.
    11·1 answer
  • Which is the most popular language used in game programming?
    5·2 answers
  • Why are peripherals added to computers?
    12·1 answer
  • All of the data in a digital book (letters, punctuation, spaces, etc) are stored and processed in a computer as binary. Break do
    15·1 answer
  • An operating system with _____ capabilities allows a user to run more than one program concurrently.
    6·1 answer
  • 6) Which of the following an OPERATING SYSTEM? a) Window 7 b) excel c) PowerPoint d) Publisher​
    13·1 answer
  • Television, video, computers, radios, and magazines used by target audiences are all what types of channels?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!