Question

In: Computer Science

Submit: One python file __name__ == "__main__" Screenshot of sample output Be sure to: Comment your...

Submit:

  • One python file __name__ == "__main__"
  • Screenshot of sample output

Be sure to:

  • Comment your code, classes and functions! Practice practice practice!
  • Use meaningful variables
  • If you do not I will remove points

Dog Walker Program

  • Create a program for a Dog Walking company to keep track of its employees, customers, and customer dogs
  • You will need the following classes:
    • Person
      • With the following attributes:
        • name
        • id_number
        • dogs : list of Dog objects
      • With the appropriate setters and getters
      • With the following subclasses:
        • DogWalker(Person)
          • With the following attributes:
            • hourly_rate : float
          • With the appropriate setters and getters
        • Customer(Person)
          • With the following attributes
            • amount_owed : float, how much they currently owe
          • With the appropriate setters and getters
    • Dog
      • With the following attributes
        • name
        • breed
        • weight
        • hours_walked
      • With the appropriate setters and getters

Programming language: Python

requirement: please follow up the rules per demonstrated above

Solutions

Expert Solution

CODE:

main.py:

from include.Person import Person
from include.Dog import Dog
from include.Customer import Customer
from include.DogWalker import DogWalker
#main method
def main():
    #list of dogs
    dogs = []
    #adding dogs
    dogs.append(Dog("Brutus","German Shepherd",74.5,4))
    dogs.append(Dog("Tommy","Pomerian",54.3,6))
    #instantiating dogWalker and Customer objects
    dogWalker = DogWalker(2.5,"Sam",24,dogs)
    customer = Customer(43.5,"Bob",3,dogs)
    #printing the details
    print('Dog Walker:')
    print(dogWalker)
    print('\nCustomer:')
    print(customer)

if __name__ == "__main__":
    main()

___________________________________________________

Dogs.py

class Dog():
    #constructor and member variables
    def __init__(self,name,breed,weight,hours_walked):
        self.name = name
        self.breed = breed
        self.weight = weight
        self.hours_walked = hours_walked
    #setters and getters
    def setName(self,name):
        self.name = name

    def setBreed(self, breed):
        self.breed = breed

    def setWeight(self,weight):
        self.weight = weight

    def setHoursWalked(self,hours_walked):
        self.hours_walked = hours_walked

    def getName(self):
        return self.name

    def getBreed(self):
        return self.breed

    def getWeight(self):
        return self.weight

    def getHoursWalked(self):
        return self.hours_walked
    #str method
    def __str__(self) -> str:
        return "Name: {}\nBreed:{}\nWeight: {}lbs\nHours Walked: {} hours".format(self.name,
                                                                                  self.breed,
                                                                                  str(self.weight),
                                                                                  str(self.hours_walked))

_________________________________________________

Person.py

class Person():
    #person constructor
    def __init__(self,name,id_number,dogs : list):
        self.name = name
        self.id_number = id_number
        self.dogs = dogs
    #setters and getters
    def getName(self):
        return self.name

    def getID(self):
        return self.id_number

    def getDogs(self):
        return self.dogs

    def setName(self,name):
        self.name = name

    def setID(self,id_number):
        self.id_number = id_number

    def setDogs(self,dogs:list):
        self.dogs = dogs
    #str method
    def __str__(self) -> str:
        #building the list of dogs string
        dogString = ""
        for i,x in enumerate(self.dogs):
            dogString = dogString + str(x) +'\n'
        return "Name: {}\nID: {}\nDogs List:\n{}".format(self.name,
                                                       str(self.id_number),
                                                       str(dogString))


_____________________________________________________

Customer.py

from include.Person import Person

class Customer(Person):
    #customer class constructor
    def __init__(self, amount_owed: float,name,id_number,dogs : list):
        self.amount_owed = amount_owed
        Person.__init__(self,name,id_number,dogs)
    #setters and getters
    def setAmountOwed(self, amount_owed):
        self.amount_owed = amount_owed

    def getAmountOwed(self):
        return self.amount_owed

    def __str__(self) -> str:
        return super().__str__()+"\nAmount Owed: ${}".format(str(self.amount_owed))

__________________________________________________

DogWalker.py

from include.Person import Person

class DogWalker(Person):
    #dogWalker class constructor
    def __init__(self, hourly_rate: float,name,id_number,dogs : list):
        self.hourly_rate = hourly_rate
        Person.__init__(self,name,id_number,dogs)
    #setters and getters
    def setHourlyRate(self, hourly_rate):
        self.hourly_rate = hourly_rate

    def getHourlyRate(self):
        return self.hourly_rate
    #str method
    def __str__(self) -> str:
        return super().__str__()+"\nHourly Rate: ${}/hour".format(str(self.hourly_rate))

____________________________________________

OUTPUT:

___________________________________________________

Feel free to ask any questions in the comments section

Thank You!


Related Solutions

Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this...
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this challenge, establish if a given integer num is a Curzon number. If 1 plus 2 elevated to num is exactly divisible by 1 plus 2 multiplied by num, then num is a Curzon number. Given a non-negative integer num, implement a function that returns True if num is a Curzon number, or False otherwise. Examples is_curzon(5) ➞ True 2 ** 5 + 1 =...
using C thank you Must submit as MS Word file with a screenshot of the 3...
using C thank you Must submit as MS Word file with a screenshot of the 3 outputs. Run your program 3 times. the output must be in a screenshot not typed for the each time you run the program. thank you Modify the code below to implement the program that will sum up 1000 numbers using 5 threads. 1st thread will sum up numbers from 1-200 2nd thread will sum up numbers from 201 - 400 ... 5th thread will...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
2. Add a title comment block to the top of the new Python file using the...
2. Add a title comment block to the top of the new Python file using the following form # A brief description of the project 3. Ask user - to enter the charge for food 4. Ask user - to enter theTip for server ( remember this is a percentage , the input therefore should be decimal. For example, for a 15% tip, 0.15 should be entered) 5. Ask user - to enter the Tax amount ( this is a...
in LINUX Inspect the login.defs file in your VM and provide a screenshot showing: LOGIN_RETRIES and...
in LINUX Inspect the login.defs file in your VM and provide a screenshot showing: LOGIN_RETRIES and LOGIN_TIMEOUT PLEASE SHOW THE STEPS
Your hardcopy submission will consist of these two things: Source code (your java file). Screenshot of...
Your hardcopy submission will consist of these two things: Source code (your java file). Screenshot of Eclipse showing output of program. (JPG or PNG format only) Write a program to play the game of Stud Black Jack. This is like regular Black Jack except each player gets 2 cards only and cannot draw additional cards. Create an array of 52 integers. Initialize the array with the values 0-51 (each value representing a card in a deck of cards) in your...
On Python Preview the provided sample file called studentdata.txt. It contains one line for each student...
On Python Preview the provided sample file called studentdata.txt. It contains one line for each student in an imaginary class. The student’s name is the first thing on each line, followed by some exam scores. The number of scores might be different for each student. Using the text file studentdata.txt write a program that calculates the average grade for each student, and print out the student’s name along with their average grade with two decimal places.
a) Submit a copy of your dataset along with a file that contains your answers to...
a) Submit a copy of your dataset along with a file that contains your answers to all of the following questions. b) What the mean and Standard Deviation (SD) of the Close column in your data set? c) If a person bought 1 share of Google stock within the last year, what is the probability that the stock on that day closed at less than the mean for that year? Hint: You do not want to calculate the mean to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT