1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
andre [41]
2 years ago
9

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 odometer reading (the actual odometer distance driven by the Taxicab, not the Euclidean distance from its starting point). 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:
Computers and Technology
1 answer:
Licemer1 [7]2 years ago
7 0

Answer:

See explaination

Explanation:

class Taxicab():

def __init__(self, x, y):

self.x_coordinate = x

self.y_coordinate = y

self.odometer = 0

def get_x_coord(self):

return self.x_coordinate

def get_y_coord(self):

return self.y_coordinate

def get_odometer(self):

return self.odometer

def move_x(self, distance):

self.x_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

def move_y(self, distance):

self.y_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

cab = Taxicab(5,-8)

cab.move_x(3)

cab.move_y(-4)

cab.move_x(-1)

print(cab.odometer) # will print 8 3+4+1 = 8

You might be interested in
I really need help please abari is writing a program which prompts a user for a value without a decimal. Which function should h
insens350 [35]

Answer:

print()

Explanation:

print allows you to add words into the script, like this;

script.parent.mouse.touch <u>then</u>

<u>print(¨ḧimenewew¨)</u>

4 0
2 years ago
Arrays are described as immutable because they are two dimensional. are arranged sequentially. can be reordered. cannot be chang
Vlada [557]

Answer:

Arrays are described as immutable because they cannot be changed once they are defined.  (D on Edge)

Explanation:

It's in the notes and I just took the test (2020)

6 0
3 years ago
Which group on the home tab contains the line spacing attribute?
Juli2301 [7.4K]

Answer:

The Paragraph group on the Home tab contains commands to set and control several format options for a paragraph. The options include alignment, indentation, line spacing, and pagination. click Ctrl+J to justify. You can indent individual paragraphs so they appear to have different margins from the rest of a document.

Explanation:

comment an let me know how it helps

8 0
2 years ago
Whose massively popular photo led to the creation of google images?
Alex
Jennifer Lopez’s picture led to the creation of google images.
5 0
3 years ago
Jim is a forensic specialist. He seized a suspect computer from a crime scene, removed the hard drive and bagged it, documented
Andreyy89

Answer: Jim left the computer unattended while shopping for supplies to be used at the next crime scene.

Explanation: While transporting the evidence to a secure location (lab), he left the computer unattended in his car and goes shopping for supplies that will be used in his next crime scenes. This act will give the criminals or their accomplice the opportunity to break into his car and tamper with what ever evidence he might have left behind in his car.

7 0
3 years ago
Other questions:
  • Jail and prison officials may generally limit inmate rights when the limitations serve
    13·2 answers
  • Harry is creating a presentation for a school event. He has to deliver the presentation to a huge audience. What should he keep
    14·2 answers
  • Which is a function of network media?
    14·2 answers
  • Why is e-mail better for informative and positive messages than for negative ones?
    6·1 answer
  • What is the subnet mask ?
    9·2 answers
  • How to fix dark images?<br><br>I am using a phone btw​
    14·2 answers
  • You are creating a presentation and you have come to the last slide. You still have more information to add. What should you do?
    7·1 answer
  • Write an application that inputs a five digit integer (The number must be entered only as ONE input) and separates the number in
    10·1 answer
  • Paula weeded 40% of her garden in 8 minutes. How many minutes will it take to weed all of her garden at this rate ?
    7·1 answer
  • A web-based program that uses artificial intelligence techniques to automate tasks such as searches is called
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!