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...
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...
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...
Please submit a screenshot of where your code got compiled, executed, showing the execution result Write...
Please submit a screenshot of where your code got compiled, executed, showing the execution result Write a program/function in python that will perform the following functions, when the program is executed, to demonstrate the features of an OOP language—ADT, inheritance, and polymorphism: Prompt a list of options—the main menu, below to compute the area of selected shape with input parameters: triangle rectangle square circle parallelogram Exit Per the selected option, prompt grader to enter the corresponding required parameters as described...
Programming Steps: (In Java) (Please screenshot your output) A. Files required or needed to be created:...
Programming Steps: (In Java) (Please screenshot your output) A. Files required or needed to be created:    1. Artist.java (Given Below)    2. p7artists.java (Input file to read from)    3. out1.txt (Output file to write to) B. Java programs needed to writeand create:    1. MyArtistList.java:    - Contains the following:        1. list - public, Arraylist of Artist.        This list will contain all entries from "p7artists.txt"        2. Constructor:        A constructor that accepts one...
Submit your solution to the problem in an Excel file. Explain your answer as necessary and...
Submit your solution to the problem in an Excel file. Explain your answer as necessary and be sure your calculations are clearly shown. ABC Corporation is large and profitable. This year it is considering buying factory equipment for $100,000,000. ABC’s cost of capital is 7%. Required: a) What is the after-tax cost of the equipment if it qualifies for 100% bonus depreciation? b) What is the after-tax cost of the equipment if it is depreciated using MACRS (7 year recovery...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT