class Dog: species = 'Canis familiaris' # data attribute species def __init__(self, name, breed): # initialize name and tricks for each dog self.name = name self.breed = breed self.tricks = [] def teach(self, trick): self.tricks.append(trick) # add passed trick to tricks list print(self.name, 'knows', trick) # print message def knows(self, trick): if trick in self.tricks: # If passed trick exists in list, print that dog knows trick else not print('Yes,', self.name, 'knows', trick) return True else: print('No', self.name, 'doesn\'t know', trick) return False
SCREENSHOT
OUTPUT
Python vUniess you need to edit, it's safer to stay in Enable Editing Propiem 1 Write...
ws. Unless you need to edit it's safer to stay in Protected View Enable Editing Alternation of generations describes plant life cycles. There are ſhow many?) generations. • The gametophyte generation begins when the process of forms (ploidy) cells. The gametophyte generation ends when a (ploidy) _ is formed by the process of_ Figure 38.4 Alternation of generations: What are the two generations in the plant life cycle? What is the male gametophyte? Female? The microsporangium in the pollen sac....
you need to edit, it's safer to stay in Protected View. Enable Editing Part 2- Time to Dig Deeper - Doin' Your Research 1. Remember critical thinking is about exposing yourself to OTHER thinking and evaluating it. Now you will RESEARCH the topic. For this you need to find 2 FACTS that support the ban and 2 FACTS that oppose the ban (you can have more but you must have a MINIMUM of two for each). You will not only...
ses. Unless you need to edit, it's safer to stay in Protected View Enable Editing activate now. Reactivate 1. Given an angle of 18°15'02', convert the angle to degrees with decimal rounded to the nearest 0.001" (4 pts.) 2. Given an angle of 48.871", convert the angle to degrees, minutes, and seconds (DMS). Round to the nearest second. (4 pts.) 3. A downhill slope measures 402.22' from point to point D. Both points are on the ground. The elevation at...
*Python* INTRODUCTION: The goal of this programming assignment is to enable the student to practice object-oriented programming using classes to create objects. PROBLEM DEFINITION: Write a class named Employee that holds the following data about an employee in attributes: name, IDnumber, department, jobTitle The class should have 8 methods as follows: For each attribute, there should be a method that takes a parameter to be assigned to the attribute. This is known as a mutator method. For each...
I need help asap, Python language 2) Write a class to represent a class to represent a Car and its passengers. Write a constructor that takes one additional parameter a number, the total seats in the car. The constructor should save this as a datamember and also initialize an additional datamember, a list, to keep track of the passengers in the car. Write method addRider that takes an additional parameter a string of the passenger to be added to the...
Write a class called Student. The specification for a Student is: Three Instance fields name - a String of the student's full name totalQuizScore - double numQuizesTaken - int Constructor Default construtor that sets the instance fields to a default value Parameterized constructor that sets the name instance field to a parameter value and set the other instance fields to a default value. Methods setName - sets or changes the student name by taking in a parameter getName - returns...
Python Classes - Write a class to determine the price of a salad and its ingredients. Write a Salad class. Your class will have two attributes: • name, which should be a string containing the name of the person who ordered the salad. • ingredients, which should be a set of strings where each string is an ingredient in the salad. __init__() The Salad class should have an __init__() method with four parameters, in the following order: • self •...
Imagine you are creating a game in which robots on two teams battle each other. A robot has an energy attribute which determines the amount of force the robot can use in attacking. Robots can combine with other robots to form compound robots; this allows them to pool their energy and mount larger attacks. For this assignment, you will develop two classes, Robot and CompoundRobot. Write a class Robot that conforms to the following specifications: 1. It has an init()...
This question is on PYTHON Object Oriented Programming using Lists only. I need the full python coding for this question. Write a FlightBooking class with 2 collections: flight(list) and landing(list). Follow names in the UML diagram given below. UML DIAGRAM: FlightBooking _flight: list _landing: list __init__(self) addFlight(self,flight) addLanding(self,landing) removeFlight(self,pilot,flightNo) removeLanding(self,landingDateTime,destination) searchFlight(self,pilot,flightNo) : Flight searchLanding(self,landingDateTime,destination) : Landing flightStr(self) : string landingStr(self) : string 1. Constructor has 0 parameters, set collections to empty lists. 2. Add methods for both collections: - 1...
can you solve it in java please Create the following: 1. Class Invoice ( the node ) that includes three instance variables: int No; // the Invoice No String CustName; // the Customer name int Amount; // the Invoice Amount Invoice next; // points to the next Invoice Default and overloaded constructors 2. Class Shop that includes three instance variables: Invoice head; Invoice Tail; Your class should have the following: • A method that initializes the instance variables....