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...
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...
Please submit 1) the source code (.java file), and 2) the screenshot of running results of...
Please submit 1) the source code (.java file), and 2) the screenshot of running results of each question. (Factorials) Write an application that calculates the factorial of 20, and display the results. Note: 1) The factorial of a positive integer n (written n!) is equal to the product of the positive integers from 1 to n. 2) Use type long. (Largest and Smallest Integers) Write an application that reads five integers and determines and prints the largest and smallest integers...
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 =...
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 Python write a program that prompts the user for a file name, make sure the...
In Python write a program that prompts the user for a file name, make sure the file exists and if it does reads through the file, count the number of times each word appears and then output the word count in a sorted order from high to low. The program should: Display a message stating its goal Prompt the user to enter a file name Check that the file can be opened and if not ask the user to try...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT