Remember that, as stated in the Code Style Guidelines, all classes in all assignments (and each of their methods) must have a docstring. Write a class named Taxicab that has three private data...


In python, must have docstrings


Thank you


Remember that, as stated in the Code Style Guidelines, all classes in all assignments (and each of their methods) must have a docstring.<br>Write a class named Taxicab that has three private data members: one that holds the current x-coordinate, one that holds the current y-coordinate, and one that holds the<br>current odometer reading (the actual odometer distance driven by the Taxicab, not the Euclidean distance from its starting point). All three data members should be updated as<br>needed so that they are always current. The class should have an init method that takes two parameters and uses them to initialize the coordinates, and also initializes the<br>odometer to zero. The class should have get methods for each data member: get_x_coord, get_y_coord, and get_odometer. The class does not need any set methods. It<br>should have a method called move_x that takes a parameter that tells how far the Taxicab should shift left or right. It should have a method called move_y that takes a<br>parameter that tells how far the Taxicab should shift up or down. For example, the Taxicab class might be used as follows:<br>cab = Taxicab(5, -8)<br>cab.move_x(3)<br>cab.move_y(-4)<br>cab.move_x(-1)<br>print(cab.get_odometer()) # prints the current odometer reading<br># creates a Taxicab object at coordinates (5, -8)<br># moves cab 3 units

Extracted text: Remember that, as stated in the Code Style Guidelines, all classes in all assignments (and each of their methods) must have a docstring. Write a class named Taxicab that has three private data members: one that holds the current x-coordinate, one that holds the current y-coordinate, and one that holds the current odometer reading (the actual odometer distance driven by the Taxicab, not the Euclidean distance from its starting point). All three data members should be updated as needed so that they are always current. The class should have an init method that takes two parameters and uses them to initialize the coordinates, and also initializes the odometer to zero. The class should have get methods for each data member: get_x_coord, get_y_coord, and get_odometer. The class does not need any set methods. It should have a method called move_x that takes a parameter that tells how far the Taxicab should shift left or right. It should have a method called move_y that takes a parameter that tells how far the Taxicab should shift up or down. For example, the Taxicab class might be used as follows: cab = Taxicab(5, -8) cab.move_x(3) cab.move_y(-4) cab.move_x(-1) print(cab.get_odometer()) # prints the current odometer reading # creates a Taxicab object at coordinates (5, -8) # moves cab 3 units "right" # moves cab 4 units "down" # moves cab 1 unit "left" The file must be named: Taxicab.py

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here