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
What are the basic parts of a radio system
Romashka-Z-Leto [24]
Today's radio consists of an antenna, printed circuit board, resistors, capacitors, coils and transformers, transistors, integrated circuits, and a speaker. All of these parts are housed in a plastic case. An internal antenna consists of small-diameter insulated copper wire wound around a ferrite core.
4 0
3 years ago
Assume a program requires the execution of 50 x 10^6 FP instructions, 110 x 10^6 INT instructions, 80 x 10^6 Load/Store (L/S) in
Svetradugi [14.3K]

Answer:

We can not improve CPI of FP instructions when we run the program two times faster because it would be negative.

Explanation:

Processor clock rate = 2 GHz

Execution Time =   ∑  (\frac{Clock cyles}{Clock rate})

Clock cycles can be determined using following formula

Clock cycles = (CPI_{FP} x  No. FP instructions )+ ( CPI_{INT} x No. INT instructions) + ( CPI_{L/S}  x No. L/S instructions ) + ( CPI_{branch} x No. branch instructions)

Clock cycles = ( 50 x 10^{6} x 1) + (  110 x 10^{6} x 1) + ( 80 x 10^{6} x 4) + ( 16 x 10^{6} x 2)

Clock cycles = 512 x 10⁶

So,Initial Execution time for FP instructions is,

    = \frac{512(10^{6}) }{2(10^{9}) }

 Initial execution Time =  256 x 10⁻³

For 16 processors ,

clock cycle = 512 x 10⁶

Execution Time = 256 x 10⁻³

To run the program two times faster, half the number of clock cycles

(\frac{Clockcycles}{2} )=   (CPI_{FP} x  No. FP instructions )+ ( CPI_{INT} x No. INT instructions) + ( CPI_{L/S}  x No. L/S instructions ) + ( CPI_{branch} x No. branch instructions)

CPI_{FP improved} x No. FP instructions  =  (\frac{Clockcycles}{2} ) -[ ( CPI_{INT} x No. INT instructions) + ( CPI_{L/S}  x No. L/S instructions ) + ( CPI_{branch} x No. branch instructions)]

CPI_{FP improved} x 50 x 10^{6}  = ( \frac{512(10)^{6} }{2} ) - [ (  110 x 10^{6} x 1) + ( 80 x 10^{6} x 4) + ( 16 x 10^{6} x 2)]

CPI_{FP improved} x 50 x 10^{6}  =  - 206 x 10^{6}

CPI_{FP improved}  = - 206 x 10^{6} / 50 x 10^{6}

CPI_{FP improved} = - 4.12 < 0

3 0
3 years ago
How many ase certifications are there for automotive technicians?
romanna [79]

Answer:

There are 50 ASE certification tests, covering almost every imaginable aspect of the automotive repair and service industry.

Explanation:

yww <33

5 0
2 years ago
The mass flow rate in a 4.0-m wide, 2.0-m deep channel is 4000 kg/s of water. If the velocity distribution in the channel is lin
IceJOKER [234]

Answer:

V = 0.5 m/s

Explanation:

given data:

width of channel =  4 m

depth of channel = 2 m

mass flow rate = 4000 kg/s = 4 m3/s

we know that mass flow rate is given as

\dot{m}=\rho AV

Putting all the value to get the velocity of the flow

\frac{\dot{m}}{\rho A} = V

V = \frac{4000}{1000*4*2}

V = 0.5 m/s

4 0
3 years ago
A clean machine is a _______________ machine.
solniwko [45]
A clean machine is a clean machine :-)
4 0
2 years ago
Other questions:
  • The enthalpy of the water entering an actual pump is 500 kJ/kg and the enthalpy of the water leaving it is 550 kJ/kg. The pump h
    10·1 answer
  • Refrigerant-134a enters a diffuser steadily as saturated vapor at 600 kPa with a velocity of 160 m/s, and it leaves at 700 kPa a
    10·2 answers
  • Draw an ERD for each of the following situations. (If you believe that you need to make additional assumptions, clearly state th
    15·1 answer
  • WhT DO FILM PRODUTION SAY WHEN REMOVING GREEN AND BLUE SCREENS.
    14·1 answer
  • The rolling process is governed by the frictional force between the rollers and the workpiece. The frictional force at the entra
    5·1 answer
  • To do you blur text in google docs
    10·1 answer
  • What form of joining uses heat to create coalescence of the materials?
    7·1 answer
  • Factors such as brake shoe orientation, pin location, and direction of rotation determine whether a particular brake shoe is con
    12·1 answer
  • Identify the prefixes used in the International System of
    15·1 answer
  • There are three homes being built, each with an identical deck on the back. Each deck is comprised of two separate areas. One ar
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!