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 different branches of engineering involved in manufacturing a general-purpose elevator?
Anestetic [448]

Answer:

technical engineering

8 0
3 years ago
La iluminación de la superficie de un patio amplio es 1600 lx cuando el ángulo de elevación del sol 53°. Calcular la iluminación
gregori [183]

Answer:

 I = 1205.69 Lx

Explanation:

The irradiation or intensity of the solar radiation on the earth is maximum for the vertical fire, with a value I₀

          I = I₀ sin θ

in this case with the initial data we can calculate the initial irradiance

         I₀ = \frac{I}{sin  \ \theta }

         I₀ = 1600 /sin 53

         I₀ = 2003.42 lx

for when the angle is θ = 37º

         I = 2003.42 sin 37

         I = 1205.69 Lx

6 0
3 years ago
JAVA HADOOP MAPREDUCE
taurus [48]

Answer:

Explanation:

package PackageDemo;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

public class WordCount {

public static void main(String [] args) throws Exception

{

Configuration c=new Configuration();

String[] files=new GenericOptionsParser(c,args).getRemainingArgs();

Path input=new Path(files[0]);

Path output=new Path(files[1]);

Job j=new Job(c,"wordcount");

j.setJarByClass(WordCount.class);

j.setMapperClass(MapForWordCount.class);

j.setReducerClass(ReduceForWordCount.class);

j.setOutputKeyClass(Text.class);

j.setOutputValueClass(IntWritable.class);

FileInputFormat.addInputPath(j, input);

FileOutputFormat.setOutputPath(j, output);

System.exit(j.waitForCompletion(true)?0:1);

}

public static class MapForWordCount extends Mapper<LongWritable, Text, Text, IntWritable>{

public void map(LongWritable key, Text value, Context con) throws IOException, InterruptedException

{

String line = value.toString();

String[] words=line.split(",");

for(String word: words )

{

Text outputKey = new Text(word.toUpperCase().trim());

IntWritable outputValue = new IntWritable(1);

con.write(outputKey, outputValue);

}

}

}

public static class ReduceForWordCount extends Reducer<Text, IntWritable, Text, IntWritable>

{

public void reduce(Text word, Iterable<IntWritable> values, Context con) throws IOException, InterruptedException

{

int sum = 0;

for(IntWritable value : values)

{

sum += value.get();

}

con.write(word, new IntWritable(sum));

}

}

}

3 0
3 years ago
Using the celsius_to_kelvin function as a guide, create a new function, changing the name to kelvin_to_celsius, and modifying th
aleksandr82 [10.1K]

Answer:

# kelvin_to_celsius function is defined

# it has value_kelvin as argument

def kelvin_to_celsius(value_kelvin):

   # value_celsius is initialized to 0.0

   value_celsius = 0.0

   

   # value_celsius is calculated by

   # subtracting 273.15 from value_kelvin

   value_celsius = value_kelvin - 273.15

   # value_celsius is returned

   return value_celsius

   

# celsius_to_kelvin function is defined

# it has value_celsius as argument

def celsius_to_kelvin(value_celsius):

   # value_kelvin is initialized to 0.0

   value_kelvin = 0.0

   

   # value_kelvin is calculated by

   # adding 273.15 to value_celsius

   value_kelvin = value_celsius + 273.15

   # value_kelvin is returned

   return value_kelvin

   

value_c = 0.0

value_k = 0.0

value_c = 10.0

# value_c = 10.0 is used to test the function celsius_to_kelvin

# the result is displayed

print(value_c, 'C is', celsius_to_kelvin(value_c), 'K')

value_k = 283.15

# value_k = 283.15 is used to test the function kelvin_to_celsius

# the result is displayed

print(value_k, 'is', kelvin_to_celsius(value_k), 'C')

Explanation:

Image of celsius_to_kelvin function used as guideline is attached

Image of program output is attached.

4 0
3 years ago
QUESTION 6
Aloiza [94]
It would be 2 Portfolio
3 0
3 years ago
Other questions:
  • You are considering building a residential wind power system to produce 6,000 kWh of electricity each year. The installed cost o
    15·1 answer
  • What kind or kinds of engineers does take to design a drone and why?
    11·1 answer
  • The rigid beam is supported by a pin at C and an A992 steel guy wire AB of length 6 ft. If the wire has a diameter of 0.2 in., d
    14·1 answer
  • A random sample of 5 hinges is selected from a steady stream of product from a punch press, and the a. b. proportion nonconformi
    12·1 answer
  • Based on the scenario, which type of engineering identifies Greg's role in Ethiopia?
    15·1 answer
  • A bronze bushing 60 mm in outer diameter and 40 mm in inner diameter is to be pressed into a hollow steel cylinder of 120-mm out
    8·1 answer
  • Guess the output of this code: print( (3**2)//2)​
    13·1 answer
  • How to comment on brainly.com and I'm only 8-years-old so keep it simple please
    9·1 answer
  • When economist determine that a nations GDP has declined, they can point to this as a sign of what?
    8·1 answer
  • All of the following affect friction EXCEPT
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!