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
rosijanka [135]
3 years ago
10

The base class Pet has attributes name and age. The derived class Dog inherits attributes from the base class Pet class and incl

udes a breed attribute. Complete the program to: Create a generic pet, and print the pet's information using print_info(). Create a Dog pet, use print_info() to print the dog's information, and add a statement to print the dog's breed attribute.

Engineering
1 answer:
Nonamiya [84]3 years ago
3 0

Answer:

Explanation:

class Pet:

   def __init__(self):

       self.name = ''

       self.age = 0

   def print_info(self):

       print('Pet Information:')

       print('   Name:', self.name)

       print('   Age:', self.age)

class Dog(Pet):

   def __init__(self):

       Pet.__init__(self)

       self.breed = ''

def main():

   my_pet = Pet()

   my_dog = Dog()

   pet_name = input()

   pet_age = int(input())

   dog_name = input()

   dog_age = int(input())

   dog_breed = input()

   my_pet.name = pet_name

   my_pet.age = pet_age

   my_pet.print_info()

   my_dog.name = dog_name

   my_dog.age = dog_age

   my_dog.breed = dog_breed

   my_dog.print_info()

   print('   Breed:', my_dog.breed)

main()

You might be interested in
Steam enters a steady-flow adiabatic nozzle with a low inlet velocity (assume ~0 m/s) as a saturated vapor at 6 MPa and expands
Sergio [31]
Yea bro I don’t really know
7 0
3 years ago
7. Which of the following is a disadvantage of an electromagnet?
Sati [7]

Answer:

I think

electromagnets require power to operate

7 0
3 years ago
I need help with this question please
solniwko [45]

Answer:

The resultant moment is 477.84 N·m

Explanation:

We note that the resultant moment is given by the moment about a given point

The length of the sides of the formed triangles are;

l = sin(40°) × 4/sin(110°) ≈ 2.736

Taking the moment about the lower left hand corner of the figure, with the convention that clockwise moments are positive, we have;

The resultant moment, ∑m, is given as follow;

∑M = 250 N × 4 m + 400 N × cos(40°) × 4 m - 400 N × cos(40°) × 2 m + 400 N × sin(40°) × 2 m × tan(40°) - 600 N × cos(40°) × 2 m - 600 N× sin(40°) × 2 m × tan(40°) = 477.837084 N·m

Therefore, the resultant moment, ∑m ≈ 477.84 N·m clockwise.

6 0
3 years ago
At what height above the surface of the earth does the weight of an object decrease to 0.8​
prohojiy [21]

Answer: That'd be about 6400km upwards, i belive.

Explanation:

8 0
2 years ago
Write 3 classes with three levels of hierarchy: Base, Derive (child of base), and D1 (child of Derive class). Within each class,
PIT_PIT [208]

Answer:

class Base

{

void m1()

{

System.out.println("Origin: Base Class");

}

}

class Derive extends Base

{

void m1()

{

System.out.println("Origin: Derived Class");

}

}

class D1 extends Derive

{

void m1()

{

System.out.println("Origin: D1 - Child of Derive Class");

}

}

class TestDynamicBinding

{

public static void main(String args[])

{

Base base = new Base(); // object of Base class

Derive derive = new Derive(); // object of Derive class

D1 d1 = new D1(); // object of D1 class

 

Base reference; // Reference of type Base

reference = base; // reference referring to the object of Base class

reference.m1();   //call made to Base Class m1 method

 

reference = derive;   // reference referring to the object of Derive class

reference.m1(); //call made to Derive Class m1 method

 

reference = d1;    // reference referring to the object of D1 class

reference.m1(); //call made to D1 Class m1 method

}

}

Explanation:

The solution demonstrates dynamic binding behavior because the linking procedure used calls overwritten method m1() is made at run time rather than doing it at the compile time. The code to be executed for this specific procedural call is also known at run time only.

6 0
3 years ago
Other questions:
  • 3/194 The assembly of two 5‐kg spheres is rotating freely about the vertical axis at 40 rev/min with θ = 90°. If the force F whi
    9·1 answer
  • Imagine you compare the effectiveness of four different types of stimulant to keep you awake while revising statistics using a o
    15·1 answer
  • -1 1/6 divided by 2 1/3
    10·1 answer
  • A fatigue test was conducted in which the mean stress was 46.2 MPa and the stress amplitude was 219 MPa.
    12·1 answer
  • A jet impinges directly on to a plate that is oriented normal to the axis of the jet. The mass flow rate of the jet is 50 kg/min
    8·1 answer
  • If you are involved in a collision and your vehicle is blocking the flow of traffic, you should
    5·1 answer
  • Nitrogen gas is compressed at steady state from a pressure of 14.2 psi and a temperature 60o F to a pressure of 120 psi and a te
    7·1 answer
  • 5 kg of a wet steam has a volume of 2 m3
    8·1 answer
  • How to update android 4.4.2 to 5.1 if there isnt any update available​
    15·2 answers
  • A jet aircraft is in level flight at an altitude of 30,000 ft with an airspeed of 500 ft/s. The aircraft has a gross weight of 1
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!