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
timofeeve [1]
3 years ago
11

#include using namespace std;class RunnerInfo { public: void SetTime(int timeRunSecs); // Time run in seconds void SetDist(doubl

e distRunMiles); // Distance run in miles double GetSpeedMph(); // Speed in miles/hour __(A)__ int timeRun; double distRun;};void __(B)__::SetTime(int timeRunSecs) { timeRun = timeRunSecs; // timeRun refers to data member}void __(C)__SetDist(double distRunMiles) { distRun = distRunMiles;}double RunnerInfo::GetSpeedMph() const { return distRun / (timeRun / 3600.0); // miles / (secs / (hrs / 3600 secs))}int main() { RunnerInfo runner1; // User-created object of class type RunnerInfo RunnerInfo runner2; // A second object runner1.SetTime(360); runner1.SetDist(1.2); runner2.SetTime(200); runner2.SetDist(0.5); cout << "Runner1's speed in MPH: " << runner1.__(D)__ << endl; cout << "Runner2's speed in MPH: " << __(E)__ << endl; return 0;}Complete the missing parts of the figure above.(b) -> Ru?(c) -> Ru?::(d) -> Get?()(e) -> runner2.?

Computers and Technology
1 answer:
Softa [21]3 years ago
5 0

Answer:

Here is the complete program:

#include <iostream>

using namespace std;  

class RunnerInfo {

  public:                                

     void SetTime(int timeRunSecs);       // Time run in seconds

     void SetDist(double distRunMiles);   // Distance run in miles

     double GetSpeedMph();                // Speed in miles/hour

   private:

     int timeRun;

     double distRun;  };    

void RunnerInfo::SetTime(int timeRunSecs) {

  timeRun = timeRunSecs;  // timeRun refers to data member

}  

void RunnerInfo::SetDist(double distRunMiles) {

  distRun = distRunMiles; }

double RunnerInfo::GetSpeedMph()  {

  return distRun / (timeRun / 3600.0); // miles / (secs / (hrs / 3600 secs))  }

int main() {

  RunnerInfo runner1; // User-created object of class type RunnerInfo

  RunnerInfo runner2; // A second object

  runner1.SetTime(360);

  runner1.SetDist(1.2);

  runner2.SetTime(200);

  runner2.SetDist(0.5);

  cout << "Runner1's speed in MPH: " << runner1.GetSpeedMph() << endl;

  cout << "Runner2's speed in MPH: " << runner2.GetSpeedMph() << endl;  

  return 0;  }

Explanation:

(A):

private:

The variables timeRun and distRun are the data members of class RunnerInfo so they should be set to be private in order to prevent access from outside the class. So they are set to private which is an access specifier.

(B):

RunnerInfo  

Here the name of the class RunnerInfo is used with double colon operator (::) which is used to qualify a C++ member function. This is used to define a function outside a class. So here the function name is SetTime() and it is defined outside class RunnerInfo. So we use resolution operator to define this function. The basic syntax is:

class_name :: function_name (args)

(C):

RunnerInfo::

This is missing in the above code. This works the same as (B).

:: double colons are called resolution operator :: and it is used  to define a function outside a class.

(D):

GetSpeedMph()

runner1 is the object of class RunnerInfo which represents Runner 1. So in order to display the Runner 1's speed in Mph, the method GetSpeedMph() is called using the object runner1. The object is basically used to access the method of class RunnerInfo. This method GetSpeedMph() computes the speed using formula distRun / (timeRun / 3600.0);  and returns the computed speed in MPH.

(E):

 runner2.GetSpeedMph()

If we see the print statement:

Runner2's speed in MPH:

This shows that the speed of 2nd Runner is required. So for this purpose, the object runner2 is used. So using this object we can call the method that computes the speed of the 2nd runner. This method is GetSpeedMph(). So using runner2 for 2nd runner we access the method GetSpeedMph() to compute the Runner2's speed in MPH.

The entire program after correction gives the following result:

Runner1's speed in MPH: 12                                                                                                                    Runner2's speed in MPH: 9

You might be interested in
Whats 9+9+9+9x999-86 divided by 874 times 8764
Alexxandr [17]

Answer:

8155.63844394

Explanation:

6 0
3 years ago
Read 2 more answers
Write a line of code to create a constant called MAX that will hold the size of an array that can store up to 25 decimal values.
Valentin [98]

Answer:

A line of code to create a constant called MAX that will hold the size of an array that can store up to 25 decimal values. Separate each item with 1 space, and end the line with a semi-colon.

Here,

const int MAX = 25;

7 0
3 years 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
3 years ago
In brainly.com which is best answerer​
mote1985 [20]

Explanation:

I don't know, because I had only spent one month in brainly. but I think it is Mister 360. s/he is a great answerer and always stay at top in leaderboard.

5 0
3 years ago
What are the possible values you can store in the C# "bool" data type?
Sergeeva-Olga [200]

Answer:

d are the values that can be stored in the c#"bool"data type

4 0
3 years ago
Other questions:
  • In distributed dos attacks, the attacker sends messages directly to ________. bots the intended victim of the dos attack backdoo
    7·1 answer
  • Select the correct answer.
    8·1 answer
  • What is Mainframe computer​
    15·1 answer
  • When planning a backup strategy, ideally one needs to prioritize important data and only back up what is absolutely necessary fo
    15·1 answer
  • Pls help ...
    13·1 answer
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • What is Error Code: 232011
    11·2 answers
  • Write a static generic method PairUtil.minmax that computes the minimum and maximum elements of an array of type T and returns a
    7·1 answer
  • Which of the following is not a benefit of introducing an e-commerce solution to an organisation?
    14·1 answer
  • In order for a computer to pass the ________, a human should have a conversation with it and not be able to tell if it was a mac
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!