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
Lunna [17]
3 years ago
4

Define the missing member function. Use "this" to distinguish the local member from the parameter name.

Computers and Technology
2 answers:
murzikaleks [220]3 years ago
5 0

Answer:

Here is the complete member function:

void CablePlan::SetNumDays(int numDays) {   //member function of class CablePlan which take numDays as parameter

this->numDays = numDays;   // refers to the fields numDays of CablePlan  class using this keyword

return;  }

Explanation:

The complete program is:  

#include <iostream>  //to use input output functions

using namespace std; //to identify objects like cin cout

class CablePlan{  //class

public:  //public methods of class

void SetNumDays(int numDays); //method of class CablePlan that takes numDays as parameter to set the days

int GetNumDays() const;  // method of class CablePlan to get no of days

private:  //private data member of class CablePlan

int numDays;  //private data member of class CablePlan that holds no of days

};

// FIXME: Define SetNumDays() member function, using "this" implicit parameter.

void CablePlan::SetNumDays(int numDays) { /

this->numDays = numDays;     // used to refer to numDays variable of CablePlan class using this keyword

return;}  

int CablePlan::GetNumDays() const {  //define member function GetNumDays

return numDays;}  

int main() {  //start of main function

CablePlan house1Plan;  //creates object of CablePlan class

house1Plan.SetNumDays(30);  //uses object to call member function of  CablePlan passing value 30 to it in order to set no of days

cout << house1Plan.GetNumDays() << endl;  //uses object to call member function of  CablePlan to get the no of days (numDays)

return 0;}

Here this keyword is used to refer to the field i.e. numDays of CablePlan class. This distinguishes local member numDays  from parameter numDays using this with -> symbol.  

'this' pointer retrieves the object's numDays  which is hidden by the local variable numDays . The output of this program is:

30

egoroff_w [7]3 years ago
5 0

Answer:

this.numDays = numDays;

Explanation:

You just need one line of code.  "this." to access the class member, and the "." is the member access operator.

You might be interested in
The Internet has made going global easier than it has ever been, but the promise of "borderless commerce" remains restrained bec
Andreyy89

Answer:

The correct option is B: Old brick-and-mortar rules, regulations, and habits

Explanation:

Globalization has been made possible because of the internet. However, the promise of what is considered "borderless commerce" is limited due to the old brick and mortar rules, regulations, and habits. Brick and mortar is considered the traditional businesses offering products and services to customer in a rented or owned store and requires face-to-face business. Hence globalization via the internet is limited because companies have to sort out their building and stores, follow every law and regulation to opening offices and other habits practiced by these brick-and-mortar businesses.

7 0
3 years ago
Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
SSSSS [86.1K]

Answer:

A pseudo code was used in calculating the body mass index (BMI) of a person. The code was executed and can be shown on the explanation section below

Explanation:

Solution

#Pseudocode program to calculate the BMI of a person

Input height in meter

Input weight in kg

BMI = Weight / (height)2

If BMI < 18.5 then

Print output as “Underweight”

ElseIf  BMI >= 18.5 and BMI < 24.9 then

Print output as “Healthy”

ElseIf bmi >= 24.9 and BMI < 30

Print output as “overweight”

Else BMI >=30 then

Print output as “Obesity”

End if

8 0
4 years ago
Define a function below called increase_elements_by_x, which takes two arguments - a list of numbers and a single positive numbe
zubka84 [21]

Answer:

function

increase_elements_by_x (list, x)

{

 var tplist = [];

 for (i = 0; i < list.length; i++)

   {

     tplist[i] = list[i] + x;

   print (tplist[i])}

 return tplist;

}

var list =[1, 3, 5];

var copyList;

var x = 3;

copyList = increase_elements_by_x (list, x);

print (copyList);

Explanation:

Create a list named list with initial data 1,3,5.

Create a function name increase_elements_by_x  which takes list and number as argument.Create empty list tplist. Loop through list, for ever index add x to list[index] and save to an empty list tplist. After loop is exited return tplist.

create a variable copylist and set it to increase_elements_by_x. Value returned by increase_elements_by_x  will be saved in copylist. print copy list to see content of copy list.

5 0
4 years ago
The _____ feature enables you to represent text as colorful visuals.
Radda [10]

Answer:

complex formatting feature enables you to represent text as colorful

visuals.

mark as brainliest

4 0
2 years ago
assume a class named window has an accessor method named getwidth that accepts no parameters and returns an int. assume further
worty [1.4K]

The set and get functions are analogous to the accessor and mutator functions of C++. They are used in place of modifying a class member directly inside an object and making it public. An accessor function must be invoked in order to gain access to a private object member.

int mVal = winarr[0].getWidth();

for(int i = 1; i < winarrsize; i++)

{

  if(winarr[i].getWidth() > mxVal)

     mVal = winarr[i].getWidth();

}

cout << "The widest width is: "

<< mVal << endl;

By using encapsulation, a programmer can specify the labels for the data members and functions as well as whether or not other classes can access them. When data members are marked as "private," member functions of other classes cannot access or modify them which allows members access to these private data.

For a member such as Level, a function like GetLevel() returns the value of the member, while a function like SetLevel() gives it a value.

To learn more about Accessor Function click here:

brainly.com/question/13098886

#SPJ4

5 0
1 year ago
Other questions:
  • You want to discard your old computer but want to securely erase the data from your hard drive, what can Use to do this?
    5·1 answer
  • what is the first step you would take when troubleshooting an external network, such as an internet connection issue?
    13·2 answers
  • What is a mortgage?
    8·2 answers
  • The main benefit of shielded twisted pair cabling over unshielded twisted pair is that STP is much more durable.
    13·1 answer
  • If you want to insert a table which ribbon should you select
    13·2 answers
  • 15. It is the process of capturing data or translating information to recording format
    12·1 answer
  • The conversion rate is the percentage of what? A. Customers who received cold calls B. Sales leads who reached the interest stag
    13·1 answer
  • Why is a Quality assurance tester needed on a software development team?
    5·1 answer
  • The events that happen in a story are called the _________________.
    14·2 answers
  • 4. Return the card number, first name, last name, and average late fee of each customer. Name this column as "Fee".
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!