Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views6 pages

Sample

Uploaded by

Hari Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

Sample

Uploaded by

Hari Priya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CAPSTONE PROJECTS- PREDICTIVE ROUTE OPTIMIZATION

program:

FRONTEND:(HTML,CSS)

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Google Maps App</title>
<!-- Tailwind CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
</head>

<body class="bg-gray-100">

<!-- Main Container -->


<div class="max-w-2xl mx-auto mt-10 p-6 bg-white rounded-lg shadow-lg">
<!-- App Title -->
<h1 class="text-3xl font-bold text-center text-blue-600 mb-8">Simple Google Maps
App</h1>

<!-- Section: List Available Locations -->


<div class="mb-8">
<button class="w-full bg-green-500 hover:bg-green-600 text-white py-2 px-4 rounded">
List Available Locations
</button>
<div class="mt-4 p-4 bg-gray-50 rounded-lg shadow-inner">
<!-- Mock data for available locations (Static Content) -->
<ul>
<li>New York</li>
<li>Los Angeles</li>
<li>Chicago</li>
<li>San Francisco</li>
<li>Miami</li>
</ul>
</div>
</div>

<!-- Section: Search for a Location -->


<div class="mb-8">
<input type="text" placeholder="Search for a location" class="w-full p-2 border-2 border-
gray-300 rounded mb-2">
<button class="w-full bg-blue-500 hover:bg-blue-600 text-white py-2 px-4 rounded">
Search Location
</button>
<div class="mt-4 p-4 bg-gray-50 rounded-lg shadow-inner">
<!-- Mock data for search results (Static Content) -->
<h2 class="text-xl font-bold">Chicago</h2>
<p><strong>Latitude:</strong> 41.8781</p>
<p><strong>Longitude:</strong> -87.6298</p>
<p><strong>Description:</strong> The Windy City</p>
</div>
</div>

<!-- Section: Get Directions -->


<div class="mb-8">
<input type="text" placeholder="From Location" class="w-full p-2 border-2 border-gray-
300 rounded mb-2">
<input type="text" placeholder="To Location" class="w-full p-2 border-2 border-gray-300
rounded mb-2">
<button class="w-full bg-yellow-500 hover:bg-yellow-600 text-white py-2 px-4 rounded">
Get Directions
</button>
<div class="mt-4 p-4 bg-gray-50 rounded-lg shadow-inner">
<!-- Mock data for directions (Static Content) -->
<h2 class="text-xl font-bold">Directions:</h2>
<p>From <strong>New York</strong> to <strong>Los Angeles</strong>:</p>
<ol class="list-decimal ml-5">
<li>Head east.</li>
<li>Continue for X miles.</li>
<li>Arrive at Los Angeles.</li>
</ol>
</div>
</div>
</div>

</body>

</html>
BACK END:

class SimpleGoogleMaps:
def _init_(self):
# Predefined dictionary of locations with some details.
self.locations = {
'New York': {'latitude': 40.7128, 'longitude': -74.0060, 'description': 'The Big Apple'},
'Los Angeles': {'latitude': 34.0522, 'longitude': -118.2437, 'description': 'City of Angels'},
'Chicago': {'latitude': 41.8781, 'longitude': -87.6298, 'description': 'The Windy City'},
'San Francisco': {'latitude': 37.7749, 'longitude': -122.4194, 'description': 'Golden Gate
Bridge'},
'Miami': {'latitude': 25.7617, 'longitude': -80.1918, 'description': 'The Magic City'},
}

def search_location(self, location_name):


# Search for the location in the predefined list.
location = self.locations.get(location_name)
if location:
return f"Location: {location_name}\nLatitude: {location['latitude']}\nLongitude:
{location['longitude']}\nDescription: {location['description']}"
else:
return "Location not found."

def get_directions(self, from_location, to_location):


# Provide a simple message about directions.
if from_location in self.locations and to_location in self.locations:
return f"Directions from {from_location} to {to_location}: \n1. Head east.\n2. Continue for
X miles.\n3. Arrival at {to_location}."
else:
return "Invalid locations for directions."

def list_locations(self):
# List all predefined locations.
return "\n".join(self.locations.keys())

# Example usage of the program:


if _name_ == "_main_":
maps = SimpleGoogleMaps()

# List available locations


print("Available Locations:\n", maps.list_locations())
# Search for a location
print("\nSearch for 'Chicago':")
print(maps.search_location('Chicago'))

# Get directions between two locations


print("\nGet Directions from 'New York' to 'Los Angeles':")
print(maps.get_directions('New York', 'Los Angeles'))

# Search for a non-existent location


print("\nSearch for 'Paris':")
print(maps.search_location('Paris'))

Output:

You might also like