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
Rama09 [41]
4 years ago
6

Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for the

given program with one call to inc_num_kids(): Kids: 0 New baby, kids now: 1
Computers and Technology
1 answer:
CaHeK987 [17]4 years ago
7 0

Answer:

The answer to this question can be given as:

Program:

#define class.

class PersonInfo:

   def __init__(self):  #constructor

       self.num_kids = 0

   def inc_num_kids(self):   #define function inc_num_kids()

       self.num_kids = self.num_kids + 1  

       return self.num_kids  #return value.

p= PersonInfo()      # creating object  

print('Kids:', p.num_kids)  #print value

p.inc_num_kids() #call function

print('New baby, kids now:', p.num_kids) #print value

Output:

Kids: 0

New baby, kids now: 1

Explanation:

The description of the above python program as follows:

  • In this program firstly we define the class that is PersonInfo. In this class we define the constructor that is def __init__() and one function that is  def inc_num_kids().
  • The constructor is called automatically when the class object is created. In this constructor, we use the self as a parameter that is used to access variables that belong to class.
  • In the constructor, we define the variable that is "num_kids". We assign value to a variable that is "0" and use the self for holding reference to the variable.
  • Then we define the function. In this function, we increment the value of the variable by 1 and return its value.
  • Then we create a class object that is p and call the function and print its value.  

You might be interested in
Calculate how many different pixel colours could be formed if one of the bytes gives the intensity of the red colour, one of the
Elena L [17]

Answer: The three RGB colors are each 8-bits (possible values [0.. 255], 2 to the power of 8 = 256) of each of Red, Green, and Blue. The three 8-bit RGB components can create up to 256×256×256 = 16.7 million possible RGB color combinations, called 24-bit "color".

Explanation:

6 0
3 years ago
When methods have ____, other programs and methods may use the methods to get access to the private data.
Nostrana [21]

When methods have public access, other programs and methods may use the methods to get access to the private data.

<h3>What do you mean by public access?</h3>

The Definition of the term public access is known to be a kind of a television channel where anybody can be able to broadcast a program

An example is the city council meeting can be able to broadcast on public access.

Hence, When methods have public access, other programs and methods may use the methods to get access to the private data.

See full question below

When methods have ____, other programs and methods may use the methods to get access to the private data.

a. private access

b. public access

c. complete access

d. all access

Learn more about public access from

brainly.com/question/2736088

#SPJ1

5 0
2 years ago
Modify your main.c file so that it allocates a two dimensional array of integers so that the array has 20 rows of 30 integers in
Alexandra [31]

Answer:

Explanation:

b

7 0
3 years ago
Select the true statement from those listed below. Java applets may be contained in files with the .class extension Java applets
tiny-mole [99]

Answer:

The correct option of the following question is the Java applets may be contained in the files with .class extension.

Explanation:

JAVA is the Programming Language that can used to create the complete applications which may be run on the single computer or can be distributed among the servers and the clients in the network.

An applet is Internet-based programs that are written in the Java programming language, which is the programming language for Web and it can be downloaded by any of the computers. An applet is also run in the HTML. It is usually embedded in the HTML page on the Website and it can be executed from the browser.

5 0
3 years ago
What is the coolest veichle u have ever seen
Ierofanga [76]
Well hypothetically I've seen a lot of cars but like Bentleys Lamborghinis Ferraris and Rolls Royce's but it'll probably hypothetically have to be my mom 2004 Toyota camery
7 0
3 years ago
Read 2 more answers
Other questions:
  • An example of software is
    9·2 answers
  • A group of users can perform certain operations on a shared workbook. Which option helps them to update and track changes in the
    14·1 answer
  • 5. If you are 16 to 20 years old, you are __________.
    14·1 answer
  • When making any change to the database structure, we may need to check for effects of the change on ________.?
    14·1 answer
  • A use case description is the best place to start for the design of the forms for a user interface.​ True False
    15·1 answer
  • Which of these is an example of a mobile app?
    12·2 answers
  • Power supply, keyboard, monitor, mouse,ROM,CPU are belongs to Output, Input or Storage device​
    7·1 answer
  • What is the output of this program? age=4 if age &gt;5: print (“more”) else: print (“less”)
    7·1 answer
  • Which unit of the computer works as the input​
    14·1 answer
  • Application for a lawn-mowing service. The lawn-mowing season lasts 20 weeks. The weekly fee for mowing a lot under 40 square fe
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!