Using Python you will create a simple class pet which will contain:
All of these data attributes except for the last one (fleas) will be unique to each object.
The fleas will be common to all pets, as they like to travel.
In your main part of your program, you will create 3 pets with various attributes (type, name, age…) which you can pick. Each pet can perform at least 2 tricks and a random number of fleas between 0 and 10. They can add new tricks to their arsenal.
You will print the information for each of the pet, and the total number of fleas the household’s pets own.
Requirements:
******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As per HomeworkLib expert answering guidelines,Experts are supposed to
answer only certain number of questions/sub-parts in a post.Please
raise the remaining as a new question as per HomeworkLib
guidelines.
******************************************************************************************
import random
import math
class Pet:
Type=""
Name=""
Age=0
Tricks=[]
Fleas=0
def __init__(self , Type, Name, Age,Tricks,Fleas):
self.Type= Type
self.Name= Name
self.Age= Age
self.Tricks= Tricks
self.Fleas= Fleas
def addTricks(self , trick):
self.Tricks.append(trick)
def getFleas(self):
return self.Fleas
Pet1= Pet("Dog", "Pinky","12",["tik","tok"],random.randint(0,10))
Pet2= Pet("cat", "Pink","1",["tk","tok"],random.randint(0,10))
Pet3= Pet("rat", "catty","11",["run","tok"],random.randint(0,10))
total=0
Pet1.addTricks("stand")
print(Pet1.Type)
print(Pet1.Name)
print(Pet1.Age)
print(Pet1.Tricks)
print(Pet1.getFleas())
total = total+ Pet1.getFleas()
print("")
print(Pet2.Type)
print(Pet2.Name)
print(Pet2.Age)
print(Pet2.Tricks)
print(Pet2.getFleas())
total = total+ Pet2.getFleas()
print("")
print(Pet3.Type)
print(Pet3.Name)
print(Pet3.Age)
print(Pet3.Tricks)
print(Pet3.getFleas())
total = total+ Pet3.getFleas()
print("")
print("Total Fleas in home = ",total)

Using Python you will create a simple class pet which will contain: Type of pet (a...
Need help finishing this code # Description : The Pet class contains fields for name, pet # type,and age. The age field is the age now # or age of pet when it passed away. (These # are all dogs I have had.) There is a static or # class variable called number_pets that # tracks how many instances have been created. # The constructor will fill all fields and add # one to the number_pets variable. # The special...
USE PYTHON CODING ####################### ## ## Definition for the class Pet ## ######################## class Pet: owner="" name="" alive=False def __init__(self,new_name): self.name=new_name self.alive=True Using the code shown above as a base write a code to do the following: - Create a separate function (not part of the class) called sameOwner which reports whether two pets have the same owner. test it to be sure it works - Add a variable age to Pet() and assign a random value between 1 and...
Inheritance and Polymorphism (use Pet.java) You are given a class named Pet.java. Create two child classes named Cat.java and Dog.java. Cat.java should add attributes for color and breed. Dog.java should add attributes for breed and size (use String for small, medium, large). Add appropriate constructors, getter/setter methods and toString() methods. In a separate file named PetDriver.java, create a main. In the main, create an ArrayList of Pet. Add an instance of Cat and an instance of Dog to the ArrayList....
Using Python. Complete the following: Create a class called Pet that has two attributes: name and breed Provide a constructor that accepts the data to initialize these attributes Provide the appropriate getter and setter methods Create a Pet object called dog and set its name to "Otis" and breed to "Pug". Print the dog's name and breed to the console.
(JAVA) Use the Pet.java program from the original problem (down below) Compile it. Create a text file named pets10.txt with 10 pets (or use the one below). Store this file in the same folder as your “class” file(s). The format is the same format used in the original homework problem. Each line in the file should contain a pet name (String), a comma, a pet’s age (int) in years, another comma, and a pet’s weight (double) in pounds. Perform the...
Project 4: Pet Store Objectives: Create multiple classes in an inheritance hierarchy Use an abstract class Use polymorphism Use an ArrayList Assignment For this project, you get to write a simplified pet store inventory program in Java. To complete this, you will need to have the following classes: Main class PetStore class Pet class Bird class Reptile class Snake class Turtle class Main class: This class is a driver class for the PetStore class. It is not part of the...
Using your Dog class from earlier this week, complete the following: Create a new class called DogKennel with the following: Instance field(s) - array of Dogs + any others you may want Contructor - default (no parameters) - will make a DogKennel with no dogs in it Methods: public void addDog(Dog d) - which adds a dog to the array public int currentNumDogs() - returns number of dogs currently in kennel public double averageAge() - which returns the average age...
Use Java and please try and show how to do each section. You are creating a 'virtual pet' program. The pet object will have a number of attributes, representing the state of the pet. You will need to create some entity to represent attributes in general, and you will also need to create some specific attributes. You will then create a generic pet class (or interface) which has these specific attributes. Finally you will make at least one subclass of...
Create a class House with the private fields: numberOfUnits of the type int, yearBuilt of the type int, assessedPrice of the type double. A constructor for this class should have three arguments for initializing these fields. Add accessors and mutators for all fields except a mutator for yearBuilt, and the method toString. Create a class StreetHouse which extends House and has additional fields: streetNumber of the type int, homeowner of the type String, and two neighbors: leftNeighbor and rightNeighbor, both...
The Program (Java) You will create a pet database program with the following operations incrementally as describe in the Milestones section. You are not required to save the pet data into a file. You must use appropriate design and make use of Object-Oriented Design. See milestones. • Add pets o Let the user add as many pets as they want. A pet is entered as a single line consisting of a name and an integer which represents the age of...