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
attashe74 [19]
2 years ago
15

Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *thi

s. Sample output for the given program:
Cars counted: 12
#include
using namespace std;

class CarCounter {
public:
CarCounter();
CarCounter& operator=(const CarCounter& objToCopy);
void SetCarCount(const int setVal) {
carCount = setVal;
}
int GetCarCount() const {
return carCount;
}
private:
int carCount;
};

CarCounter::CarCounter() {
carCount = 0;
return;
}

// FIXME write copy assignment operator

/* Your solution goes here */

int main() {
CarCounter frontParkingLot;
CarCounter backParkingLot;

frontParkingLot.SetCarCount(12);
backParkingLot = frontParkingLot;

cout << "Cars counted: " << backParkingLot.GetCarCount();

return 0;
}
Computers and Technology
1 answer:
Olin [163]2 years ago
5 0

The following cose will be used to copy assignment operator for CarCounter

<u>Explanation:</u>

Complete Program:

#include <iostream>

using namespace std;

class CarCounter

{

public:

CarCounter();

CarCounter& operator=(const CarCounter& objToCopy);

void SetCarCount(const int setVal)

{

 carCount = setVal;

}

int GetCarCount() const

{

 return carCount;

}

private:

int carCount;

};

CarCounter::CarCounter()

{

carCount = 0;

return;

}

// FIXME write copy assignment operator

/* Your solution goes here */

CarCounter& CarCounter::operator=(const CarCounter& objToCopy)

{

if(this != &objToCopy)

 carCount = objToCopy.carCount;

return *this;

}

int main()

{

CarCounter frontParkingLot;

CarCounter backParkingLot;

frontParkingLot.SetCarCount(12);

backParkingLot = frontParkingLot;

cout << "Cars counted: " << backParkingLot.GetCarCount();

cout << endl << endl;

system("pause");

return 0;

}

You might be interested in
Chinh wants to have a program print, "Sorry, but that isn’t one of your options" until the user enters the correct information.
kolbaska11 [484]

Answer:

a wile loop

Explanation:

8 0
1 year ago
Consider a single-platter disk with the following parameters: rotation speed: 7200 rpm; number of tracks on one side ofplatter:
horsena [70]

Answer:

Given Data:

Rotation Speed = 7200 rpm

No. of tracks on one side of platter = 30000

No. of sectors per track = 600

Seek time for every 100 track traversed = 1 ms

To find:

Average Seek Time.

Average Rotational Latency.

Transfer time for a sector.

Total Average time to satisfy a request.

Explanation:

a) As given, the disk head starts at track 0. At this point the seek time is 0.

Seek time is time to traverse from 0 to 29999 tracks (it makes 30000)

Average Seek Time is the time taken by the head to move from one track to another/2

29999 / 2 = 14999.5 ms

As the seek time is one ms for every hundred tracks traversed.  So the seek time for 29,999 tracks traversed is

14999.5 / 100 = 149.995 ms

b) The rotations per minute are 7200

1 min = 60 sec

7200 / 60 = 120 rotations / sec

Rotational delay is the inverses of this. So

1 / 120 = 0.00833 sec

          = 0.00833 * 100

          = 0.833 ms

So there is  1 rotation is at every 0.833 ms

Average Rotational latency is one half the amount of time taken by disk to make one revolution or complete 1 rotation.

So average rotational latency is: 1 / 2r

8.333 / 2 = 4.165 ms

c) No. of sectors per track = 600

Time for one disk rotation = 0.833 ms

So transfer time for a sector is: one disk revolution time / number of sectors

8.333 / 600 = 0.01388 ms = 13.88 μs

d)  Total average time to satisfy a request is calculated as :

Average seek time + Average rotational latency + Transfer time for a sector

= 149.99 ms + 4.165 ms + 0.01388 ms

= 154.168 ms

4 0
1 year ago
RFID tags are used in secure environments primarily due to the fact they are impossible to counterfeit.
denis23 [38]

Answer: True

Explanation:

 Yes, the given statement is true that the RFID tags are basically used in the secure system because it is impossible to counterfeit.

RFID basically stand for the radio frequency identification that provide a method to retrieve the data or information quickly from the system. It basically used as radio wave technology in which we can easily track the objects and people by using proper programmed data.

The tag is basically placed in the object for unique identification. There are basically two types of tags in the RFID that is active and passive.

4 0
1 year ago
Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns
serious [3.7K]

Answer:

// import the Scanner class

// to allow the program receive user input

import java.util.Scanner;

// The class Solution is defined

public class Solution{

   // main method to begin program execution

   public static void main(String[] args) {

       // scanner object scan is declared

       Scanner scan = new Scanner(System.in);

       // Prompt the user to enter a number

       System.out.println("Enter the number of stars you want: ");

       // user input is assigned to numOfStar

       int numOfStar = scan.nextInt();

       // call the makeStars method

       makeStars(numOfStar);

   }

   

   // makeStars method print stars using recursion

   // the method call itself till starNum == 0

   public static void makeStars(int starNum){

       if (starNum != 0){

           System.out.print("*");

           makeStars(starNum -1);

       }

   }

}

Explanation:

The code is well comment and solve the problem using recursion.

6 0
2 years ago
Robin wants her presentation to move from one slide to another with special motion effects. Which option should Robin use?
topjm [15]
If this is in power point, then she should use the <em>transitions </em>tab on the ribbon. =)
3 0
2 years ago
Read 2 more answers
Other questions:
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • Which data type stores images and audio visual clips?
    15·1 answer
  • Suppose you develop an app and want to generate revenue but do not want to maintain the app. What would be your best choice?
    9·1 answer
  • The final step of the DHCP Discovery process is known as ______.
    5·1 answer
  • In which of these places might you be most likely to find a peer-to-peer network? On the Internet In a hospital In a home In a l
    5·2 answers
  • Edward has started up a new company with his friend, Matthew. Currently, he has only two people working with him. Which type of
    8·1 answer
  • A remediation liaison makes sure all personnel are aware of and comply with an organization's policies.
    9·1 answer
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
  • Cloud storage refers to the storage of data on ______.a. your mobile device.b. your desktop computer.c. an external drive.d. a s
    7·1 answer
  • _____________ data is what is translated to digital format so it can be stored in a computer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!