Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import math class Location: #TODO: Implement the Location class according to the given UML class diagram and descriptions class Car: #TODO: Implement the Car class

import math
class Location:
#TODO: Implement the Location class according to the given UML class diagram and descriptions
class Car:
#TODO: Implement the Car class according to the given UML class diagram and descriptions
class Passenger:
#TODO: Implement the Passenger class according to the given UML class diagram and descriptions
class RideSharingApp:
#TODO: Implement the RideSharingApp class according to the given UML class diagram and descriptions
#For the remaining code (after this line), no modification is required
print ('-_-_object creation
location1= Location (2,1)
location2= Location (-4,1)
car1= Car('car1', location1,0.61)
car2, location2,0.50)
print('Car object 1 created: ', car1)
print('Car object 2 created:', car2)
location3= Location (-2,3)
location 4= Location (0,0)
passenger1= Passenger passenger 1', Location3)
passenger2= Passenger ('passenger2', location4)
print ('Passenger object 1 created: ', passenger1)
print ('Passenger object 2 created:'', passenger2)
mobileApp = RideSharingApp()
mobileApp.add_car(car1)
mobileApp.add_car(car2)
mobileApp.add_passenger (passenger 1)
mobileApp.add_passenger(passenger 2)
mobileApp. find_cheapest_car()
mobileApp.find_cheapest_car()
mobileApp.find_nearest_car(passenger1)
mobileApp.find_nearest_car(passenger 2)
car1.move_to (0,-5)
passenger1.move_to (0,3)
print ('car1's location has been updated:', car1)
print('passenger1's location has been updated:', passenger1)
mobileApp.find_cheapest_car()
mobileApp.find_cheapest_car()
mobileApp.find_nearest_car(passenger 1)
mobileApp.find_nearest_car(passenger2)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

U11 Informing Industry: Publicizing Contract Actions 317

Answered: 1 week ago