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
Anuta_ua [19.1K]
4 years ago
10

python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that ho

lds 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:
Blizzard [7]4 years ago
5 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
In older systems, often the user interface mainly consisted of ____-control screens that allowed a user to send commands to the
Scilla [17]

Answer:

Process

Explanation:

In older systems, the user interface mainly consisted of process-control screens that allowed a user to send commands to the system. These systems were used in a great variety of industries, and it gave the user control over process measurements or process variables. It also allowed the user to view the current state of the process, modify the operation of the process, and perform other related actions.

6 0
4 years ago
Classified Computer by their age​
andreyandreev [35.5K]

Answer:

The answer is below

Explanation:

Classification of computers by age are the following:

First generation from 1940 to 1956. For example, ENIAC using a vacuum tube

Second generation from 1956 to 1963. For example, IBM 7070 using transistor

Third generation from 1964 to 1971. For example, this type of computers use an Integrated circuit

Fourth generation from 1972 to 2010. For example, IBM 5100 using a microprocessor.

Fifth-generation from 2010 to present For example IBM Watson, using Artificial intelligence.

5 0
3 years ago
Arpenet was the computer created by the military true or false
Sphinxa [80]

True. It was a project that the pentagon was working on in the 60's

3 0
3 years ago
A network technician attempts to ping www.example.net from a customer computer, but the ping fails. access to mapped network dri
S_A_V [24]

It appears that the local network connection (ethernet, Wi-Fi, etc.) is working but the gateway to the WAN is down.

8 0
3 years ago
You are creating a classification model from a DataFrame that contains data about traffic on highways in a US state, which conta
torisob [31]

Answer:

Split the data into two randomly sampled DataFrame,and then train the model with one DataFrame and test it with the other .As we have know labels in the data frame ,so this approch will give us a better picture on how accuractly our model is trained

Explanation:

Split the data into two randomly sampled DataFrame,and then train the model with one DataFrame and test it with the other .As we have know labels in the data frame ,so this approch will give us a better picture on how accuractly our model is trained

3 0
3 years ago
Other questions:
  • What helps in determining the reliability of a person to repay debt?
    12·2 answers
  • The labor market shows the:
    11·1 answer
  • What attack occurs when a domain pointer that links a domain name to a specific web server is changed by a threat actor?
    11·1 answer
  • Terry is having a problem with his computer screen. He said the screen looks distorted. When you go to check his monitor, you no
    8·1 answer
  • Name this<br><br>The feature allows you to add text/picture in the background of the document. ​
    11·1 answer
  • Which characteristic describes a flash lighting setup?
    6·1 answer
  • For anyone who plays warzone, do you think the hdr has earned its spot back after the spr nerf? Be completely honest plz.​
    8·1 answer
  • Universal Containers sells its products online using a system built on Force Sites. The orders are captured and processed in Sal
    7·1 answer
  • 25 Points Asap <br> Write a Java program named Light.java that displays a light bulb shown below:
    14·1 answer
  • 100 POINTS PLEASE HELP Type the correct answer in the box. Spell all words correctly.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!