diff --git a/Team-CodeBlooded-Trip_Planner/App.java b/Team-CodeBlooded-Trip_Planner/App.java new file mode 100644 index 0000000..6233f75 --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/App.java @@ -0,0 +1,56 @@ +package trip; +import java.util.*; + +public class App { + Scanner scn = new Scanner(System.in); + int n = 26; + Graph g = new Graph(n); + int c = 0; + + User user = null; + User u = null; + + //SIGNUP METHOD + void signup() { + System.out.println("\n\t\t\t\t\t\t-*-*-Signup Window-*-*-"); + System.out.print("\t\t\t\t\t\t Enter name: "); + String name = scn.nextLine(); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter mail_id: "); + String id = scn.nextLine(); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter password: "); + String password = scn.nextLine(); + System.out.println(); + u = new User(name,id,password); + c++; + } + + //LOGIN WINDOW + public void login() { + System.out.println("\n\t\t\t\t\t\t-*-*-Login Window-*-*-"); + System.out.print("\t\t\t\t\t\t Enter name: "); + String user_name = scn.nextLine(); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter mail_id: "); + String mail_id = scn.nextLine(); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter password: "); + String password = scn.nextLine(); + user = new User(user_name,mail_id,password); + } + + //LOGOUT METHOD + public void logout() { + user = null; + System.out.println("\t\t\t\t\t\t Loggedout successfully"); + System.out.print("\t\t\t\t\t\t Do you want to login again? Enter yes/no"); + String choice = scn.nextLine(); + System.out.println(); + if (choice.equalsIgnoreCase("yes")) { + login(); + } else { + return; + } + } +} \ No newline at end of file diff --git a/Team-CodeBlooded-Trip_Planner/Backend.java b/Team-CodeBlooded-Trip_Planner/Backend.java new file mode 100644 index 0000000..bea88f8 --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/Backend.java @@ -0,0 +1,296 @@ +package trip; + +import java.sql.*; + +import java.util.*; + +public class Backend { + + Scanner scn = new Scanner(System.in); + Connection conn = null;// + Statement stmt = null;// + PreparedStatement p = null; + ResultSet rs = null; + ResultSet rs2 = null; + String USER = "root";// + String PASS = "root123";// + String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";// + String DB_URL = "jdbc:mysql://localhost:3306/trip_planner?autoReconnect=true&useSSL=false"; + App a = new App();//Creating object of App class + + void call() { + try { + Class.forName(JDBC_DRIVER); + conn = DriverManager.getConnection(DB_URL, USER, PASS); + + stmt = conn.createStatement(); + + System.out.format("\t%1$60s","TRIP_PLANNER\n"); + String q = "Select * from Connloc"; + p = conn.prepareStatement(q); + rs = p.executeQuery(); + //Creating map of trip spots + while (rs.next()) { + int u = rs.getInt("city_idx"); + int v = rs.getInt("conn_idx"); + int w = rs.getInt("dist"); + a.g.addRoute(u, v, w); + } + + boolean c = true; + //MAIN MENU + while (c) { + System.out.format("%1$105s","******************************************************************************************"); + System.out.println(); + System.out.println("\t\t\t\t\t\t\t HOME"); + System.out.format("%1$90s","**********************************************************"); + System.out.println(); + System.out.println("\t\t\t\t\t\t\t 1.Signup"); + System.out.println("\t\t\t\t\t\t\t 2.Login"); + System.out.println("\t\t\t\t\t\t\t 3.Exit"); + + System.out.format("%1$105s","******************************************************************************************"); + System.out.println(); + System.out.println("\t\t\t\t\t\t Enter your choice: "); + System.out.print("\t\t\t\t\t\t\t "); + int ch = scn.nextInt(); + switch (ch) { + case 1: + //SIGNUP WINDOW + a.signup(); + String q1 = "insert into user values ('" + a.u.user_name + "','" + a.u.mail_id + "','" + + a.u.password + "')"; + //CHECKING USER VALIDITY + try { + stmt.executeUpdate(q1); + System.out.println("\t\t\t\t\t\t Signed up successfully!!\n"); + } + catch(SQLException d) { + System.out.println("\t\t\t\t\t\t User already exists!!\n"); + } + + break; + case 2: + //LOGIN WINDOW + a.login(); + String q2 = "select * from user where mail_id ='" + a.user.mail_id + "'"; + + p = conn.prepareStatement(q2); + rs2 = p.executeQuery(); + //REDIRECTING UNREGISTERED USER TO SIGNUP WINDOW + if (!rs2.next()) { + + System.out.println( + "User not registered\nDo you wish to register?\nIf yes enter 1\n If no enter 2"); + int cho = scn.nextInt(); + System.out.println(); + if (cho == 1) { + a.signup(); + } else { + return; + } + } else { + //CHECKING CREDENTIALS VALIDITY + String ps = ""; + ps = rs2.getString("password"); + String un = ""; + un = rs2.getString("user_name"); + if (!ps.equals(a.user.password) || !un.equals(a.user.user_name)) { + System.out.println("\t\t\t\t\t\t Wrong credentials!!"); + break; + } else { + System.out.println("\t\t\t\t\t\t Successfully Logged in!!"); + scn.nextLine(); + //GETTING CURRENT LOCATION OF USER + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter your location: "); + String l = scn.nextLine(); + System.out.println(); + a.user.city = l; + int src = -1, dest = 0; + boolean d = true; + a.g.display(1); + //DISPLAY CITIES + System.out.println("\t\t\t\t\t\t Trip Spots to visit"); + for (int i = 0; i < a.g.all.size()/2; i++) { + q = "Select city_name from Location where city_idx=" + a.g.all.get(i); + q2 = "Select city_name from Location where city_idx="+a.g.all.get(24-i); + p = conn.prepareStatement(q); + rs = p.executeQuery(); + String city = " "; + while (rs.next()) { + city = rs.getString("city_name"); + } + p = conn.prepareStatement(q2); + rs = p.executeQuery(); + String city1 = " "; + while (rs.next()) { + city1 = rs.getString("city_name"); + } + //System.out.println(city+"\t\t\t\t\t\t\t "+city1); + System.out.print("\t\t\t\t"); + System.out.printf("%20s %20s",city,city1); + System.out.println(); + } + a.g.all.clear(); + while (d) { + //NAVIGATION MENU + System.out.format("%1$90s","**********************************************************"); + System.out.println(); + System.out.println("\t\t\t\t\t\t 1.Find your destination"); + System.out.println("\t\t\t\t\t\t 2.See recommended trip spots"); + System.out.println("\t\t\t\t\t\t 3.logout"); + System.out.format("%1$90s","**********************************************************"); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter your choice: "); + //System.out.print("\t\t\t\t\t\t"); + int choice = scn.nextInt(); + System.out.println(); + System.out.println(); + + if (choice == 1) { + System.out.format("%1$90s","**********************************************************"); + System.out.println(); + System.out.println("\t\t\t\t\t\t Do you want to continue with your current location"); + System.out.println("\t\t\t\t\t\t 1.Yes"); + System.out.println("\t\t\t\t\t\t 2.No"); + System.out.format("%1$90s","**********************************************************"); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter your choice: "); +// System.out.print("\t\t\t\t\t\t"); + int chs = scn.nextInt(); + scn.nextLine(); + System.out.println(); + switch (chs) { + case 1: + //NAVIGATING FROM CURRENT LOCATION TO SPECIFIED DESTINATION + System.out.print("\t\t\t\t\t\t Enter your destination: "); + String destination = scn.nextLine(); + System.out.println(); + q1 = "select city_idx from location where city_name = '" + destination + "'"; + q2 = "select city_idx from location where city_name = '" + l + "'"; + p = conn.prepareStatement(q2); + rs = p.executeQuery(); + while (rs.next()) { + src = rs.getInt("city_idx"); + } + + p = conn.prepareStatement(q1); + rs = p.executeQuery(); + while (rs.next()) { + dest = rs.getInt("city_idx"); + } + //USING DJIKSTRA ALGORITHM TO GET SHORTEST PATH + a.g.dijkstra(a.g.graph, src, dest); + a.g.dijkstras(a.g.graph, src,dest); +// System.out.println("size = "+a.g.parent.length); + System.out.print("\t\t\t\t"); + for (int i = 0; i < a.g.path.size(); i++) { + q = "Select city_name from Location where city_idx=" + a.g.path.get(i); + p = conn.prepareStatement(q); + rs = p.executeQuery(); + String city = " "; + while (rs.next()) { + city = rs.getString("city_name"); + } + System.out.print(city+" => "); + } + a.g.path.clear(); + System.out.println(); + System.out.print("\t\t\t\t"); + System.out.println( + String.format("Distance from %s to %s is %s km with cost %s rupees", l, + destination, a.g.dist, a.g.total_cost)); + break; + case 2: + //NAVIGATING FROM SPECIFIED LOCATION TO SPECIFIED DESTINATION + System.out.print("\t\t\t\t\t\t Enter starting location: "); + String source = scn.nextLine(); + System.out.println(); + System.out.print("\t\t\t\t\t\t Enter your destination: "); + destination = scn.nextLine(); + System.out.println(); + q1 = "select city_idx from location where city_name = '" + destination + "'"; + q2 = "select city_idx from location where city_name = '" + source + "'"; + p = conn.prepareStatement(q2); + rs = p.executeQuery(); + while (rs.next()) { + src = rs.getInt("city_idx"); + } + + p = conn.prepareStatement(q1); + rs = p.executeQuery(); + while (rs.next()) { + dest = rs.getInt("city_idx"); + } + //USING DJIKSTRA ALGORITHM TO GET SHORTEST PATH + a.g.dijkstra(a.g.graph, src, dest); + //System.out.println(a.g.path); + a.g.dijkstras(a.g.graph, src,dest); +// System.out.println("size = "+a.g.parent.length); + System.out.print("\t\t\t\t"); + for (int i = 0; i < a.g.path.size(); i++) { + q = "Select city_name from Location where city_idx=" + a.g.path.get(i); + p = conn.prepareStatement(q); + rs = p.executeQuery(); + String city = " "; + while (rs.next()) { + city = rs.getString("city_name"); + } + System.out.print(city+" => "); + } + a.g.path.clear(); + System.out.println(); + System.out.print("\t\t\t\t"); + System.out.println( + String.format("Distance from %s to %s is %s km with cost %s rupees", + source, destination, a.g.dist, a.g.total_cost)); + break; + + } + } else if (choice == 2) { + //NEARBY PLACES FOR EXPLORATION USING BFS + q = "Select city_idx from Location where city_name='" + l + "'"; + p = conn.prepareStatement(q); + rs = p.executeQuery(); + while (rs.next()) { + src = rs.getInt("city_idx"); + } + a.g.BFS_List(src); + System.out.println("\t\t\t\t\t\t Places near " + l + " =>"); + for (int i = 0; i < a.g.cl.size(); i++) { + q = "Select city_name from Location where city_idx=" + a.g.cl.get(i); + p = conn.prepareStatement(q); + rs = p.executeQuery(); + String city = " "; + while (rs.next()) { + city = rs.getString("city_name"); + } + System.out.println("\t\t\t\t\t\t"+city); + } + a.g.cl.clear(); + } else { + System.out.println("\t\t\t\t\t\t Logged Out Successfully!!"); + d = false; + } + + } + } + + } + break; + case 3: + System.out.println("\t\t\t\t\t\t Thank you!!"); + c = false; + break; + } + } + + } catch (ClassNotFoundException e) { + System.out.println("\t\t\t\t\t\t Executed!!"); + } catch (SQLException se) { + System.out.println("\t\t\t\t\t\t SQL Exception!!"); + } + } + +} diff --git a/Team-CodeBlooded-Trip_Planner/Graph.java b/Team-CodeBlooded-Trip_Planner/Graph.java new file mode 100644 index 0000000..ba7367f --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/Graph.java @@ -0,0 +1,315 @@ +package trip; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.Scanner; +import trip.*; + +public class Graph { + //LOCATION DETAILS + class Location { + int idx; + int pinno; + String city; + String state; + LinkedList connectedLocation = new LinkedList<>(); + + Location(int i, String city, String state) { + idx = i; + this.city = city; + this.state = state; + } + } + Scanner scn = new Scanner(System.in); + + List lcn = new ArrayList<>(); + + //Backend b = new Backend(); + Node[] head; + int n, e, size = 0; + int graph[][]; + int src, dest, total_cost, dist; + List cl = new ArrayList(); + List all = new ArrayList(); + ArrayList path = new ArrayList(); + //List parent = new ArrayList(25); + + int parent[] = new int[26]; + public Graph(int n) { + this.n = n; + graph = new int[n][n]; + head = new Node[n]; + } + + //METHOD TO ADD ROUTE BETWEEN TWO CITIES + void addEdge(int u, int v, int w) { + Node new_node = new Node(v, w); + if (head[u] == null) { + head[u] = new_node; + return; + + } + Node temp = head[u]; + while (temp.next != null) { + temp = temp.next; + } + + temp.next = new_node; + } + + //BFS METHOD OF TRAVERSING CITIES + void BFS_List(int v) { + + Node ptr; + int visited[] = new int[n]; + int flag = 0; + for (int i = 1; i < n; i++) { + visited[i] = 0; + } + + visited[v] = 1; // mark visited vertex to 1 + Queue q = new LinkedList(); + q.add(v); // add vertex in queue + while (!q.isEmpty()) { + v = q.remove(); // remove vertex + cl.add(v); + while (flag <= 1) {//TO GET FIRST LAYER OF NEIGHBOURING CITIES + if (head[v] != null) { + ptr = head[v]; + while (ptr != null) { + if (visited[(ptr.dest)] == 0) { + q.add((ptr.dest)); + visited[(ptr.dest)] = 1; + flag++; + } + ptr = ptr.next; + + } + + + } + } + } + } + + void display(int v) { + + Node ptr; + int visited[] = new int[n]; + for (int i = 1; i < n; i++) { + visited[i] = 0; + } + visited[v] = 1; // mark visited vertex to 1 + Queue q = new LinkedList(); + q.add(v); // add vertex in queue + while (!q.isEmpty()) { + v = q.remove(); // remove vertex + all.add(v); + if (head[v] != null) { + ptr = head[v]; + while (ptr != null) { + if (visited[(ptr.dest)] == 0) { + q.add((ptr.dest)); + visited[(ptr.dest)] = 1; + } + ptr = ptr.next; + + } + } + } + } + + //ADDING ROUTE BETWEEN TWO CITIES INTO MAP + void addRoute(int c1, int c2, int w) { + + graph[c1][c2] = w; + graph[c2][c1] = w; + addEdge(c1, c2, w); + + } + + + + private static final int NO_PARENT = -1; + + // Function that implements Dijkstra's + // single source shortest path + // algorithm for a graph represented + // using adjacency matrix + // representation + public void dijkstras(int[][] adjacencyMatrix, int startVertex,int d) + { + int nVertices = 26; + + // shortestDistances[i] will hold the + // shortest distance from src to i + int[] shortestDistances = new int[nVertices]; + + // added[i] will true if vertex i is + // included / in shortest path tree + // or shortest distance from src to + // i is finalized + boolean[] added = new boolean[nVertices]; + + // Initialize all distances as + // INFINITE and added[] as false + for (int vertexIndex = 0; vertexIndex < nVertices; + vertexIndex++) + { + shortestDistances[vertexIndex] = Integer.MAX_VALUE; + added[vertexIndex] = false; + } + + // Distance of source vertex from + // itself is always 0 + shortestDistances[startVertex] = 0; + + // Parent array to store shortest + // path tree + int[] parents = new int[nVertices]; + + // The starting vertex does not + // have a parent + parents[startVertex] = NO_PARENT; + + // Find shortest path for all + // vertices + for (int i = 1; i < nVertices; i++) + { + + // Pick the minimum distance vertex + // from the set of vertices not yet + // processed. nearestVertex is + // always equal to startNode in + // first iteration. + int nearestVertex = -1; + int shortestDistance = Integer.MAX_VALUE; + for (int vertexIndex = 0; + vertexIndex < nVertices; + vertexIndex++) + { + if (!added[vertexIndex] && + shortestDistances[vertexIndex] < + shortestDistance) + { + nearestVertex = vertexIndex; + shortestDistance = shortestDistances[vertexIndex]; + } + } + + // Mark the picked vertex as + // processed + added[nearestVertex] = true; + + // Update dist value of the + // adjacent vertices of the + // picked vertex. + for (int vertexIndex = 0; + vertexIndex < nVertices; + vertexIndex++) + { + int edgeDistance = adjacencyMatrix[nearestVertex][vertexIndex]; + + if (edgeDistance > 0 + && ((shortestDistance + edgeDistance) < + shortestDistances[vertexIndex])) + { + parents[vertexIndex] = nearestVertex; + shortestDistances[vertexIndex] = shortestDistance + + edgeDistance; + } + } + } + + printSolution(startVertex, shortestDistances, parents,d); + + } + + + + + + private void printSolution(int startVertex, int[] distances, int[] parents,int d) { + // TODO Auto-generated method stub + int nVertices = distances.length; +// System.out.print("Index\t Distance\tPath"); + + for (int vertexIndex = 1; + vertexIndex < nVertices; + vertexIndex++) + { + if (vertexIndex != startVertex && vertexIndex==d) + { +// System.out.print("\n\t\t\t\t" + (startVertex) + " -> "); +// System.out.print((vertexIndex) + " \t\t "); +// System.out.print(distances[vertexIndex] + "\t\t"); + printPath(vertexIndex, parents); + } + } + } + + public void printPath(int currentVertex, int[] parents) { + +// Base case : Source node has +// been processed + if (currentVertex == NO_PARENT) { + return; + } + printPath(parents[currentVertex], parents); + + //System.out.print(b.getcity(currentVertex) + " "); + path.add(currentVertex); + } + + private static int findMinDistance(int[] distance, boolean[] visitedVertex) { + int minDistance = Integer.MAX_VALUE; + int minDistanceVertex = 0; + for (int i = 0; i < distance.length; i++) { + if (!visitedVertex[i] && distance[i] < minDistance) { + minDistance = distance[i]; + minDistanceVertex = i; + } + } + return minDistanceVertex; + } +//DJIKSTRA ALGORITHM TO GET SHORTEST PATH + public void dijkstra(int[][] graph, int source, int dest) { + int count = graph.length; + boolean[] visitedVertex = new boolean[count]; + int[] distance = new int[count]; + for (int i = 0; i < count; i++) { + visitedVertex[i] = false; + distance[i] = Integer.MAX_VALUE; + } + + // Distance of self loop is zero + distance[source] = 0; + for (int i = 0; i < count; i++) { + + // Update the distance between neighboring vertex and source vertex + int u = findMinDistance(distance, visitedVertex); + visitedVertex[u] = true; + + // Update all the neighboring vertex distances + for (int v = 0; v < count; v++) { + if (!visitedVertex[v] && graph[u][v] != 0 && (distance[u] + graph[u][v] < distance[v])) { + parent[v] = u; + distance[v] = distance[u] + graph[u][v]; + } + } + + } + for (int i = 1; i <= 25; i++) { + if (i == dest) { + total_cost = distance[i] * 2; + src = source; + dest = i; + dist = distance[i]; + } + } + + } + +} diff --git a/Team-CodeBlooded-Trip_Planner/MYSQL DATABASE USED.txt b/Team-CodeBlooded-Trip_Planner/MYSQL DATABASE USED.txt new file mode 100644 index 0000000..0be8193 --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/MYSQL DATABASE USED.txt @@ -0,0 +1,174 @@ +Enter password: ******* +Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 142 +Server version: 8.0.28 MySQL Community Server - GPL + +Copyright (c) 2000, 2022, Oracle and/or its affiliates. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql> use trip_planner; +Database changed +mysql> show tables; ++------------------------+ +| Tables_in_trip_planner | ++------------------------+ +| connloc | +| location | +| user | ++------------------------+ +3 rows in set (0.12 sec) + +mysql> select * from connloc; ++----------+---------------------+----------+------+ +| city_idx | Connected_Locations | conn_idx | dist | ++----------+---------------------+----------+------+ +| 1 | Pondicherry | 19 | 368 | +| 1 | Hyderabad | 20 | 991 | +| 1 | Kanniyakumari | 24 | 259 | +| 1 | Banglore | 25 | 446 | +| 2 | Delhi | 3 | 285 | +| 2 | Amritsar | 9 | 645 | +| 2 | Pune | 13 | 1156 | +| 2 | Kutch | 14 | 854 | +| 3 | Jaipur | 2 | 285 | +| 3 | Varanasi | 4 | 809 | +| 3 | Darjeeling | 5 | 1425 | +| 3 | Manali | 7 | 596 | +| 3 | Amritsar | 9 | 447 | +| 3 | Khajuraho | 10 | 630 | +| 3 | Pune | 13 | 1426 | +| 3 | Hampi | 23 | 1872 | +| 3 | Bangalore | 25 | 2190 | +| 4 | Kaziranga NP | 12 | 1300 | +| 4 | Khajuraho | 10 | 400 | +| 5 | Delhi | 3 | 1425 | +| 4 | Delhi | 3 | 809 | +| 5 | Kaziranga NP | 12 | 635 | +| 6 | Amritsar | 9 | 853 | +| 6 | Manali | 7 | 433 | +| 7 | Ladakh | 6 | 433 | +| 7 | Amritsar | 9 | 395 | +| 7 | Delhi | 3 | 596 | +| 8 | Khajuraho | 10 | 391 | +| 8 | Hampi | 23 | 1122 | +| 9 | Ladakh | 6 | 853 | +| 9 | Manali | 7 | 395 | +| 9 | Delhi | 3 | 447 | +| 9 | Jaipur | 2 | 645 | +| 10 | Delhi | 3 | 630 | +| 10 | Varanasi | 4 | 400 | +| 10 | Kanha NP | 8 | 391 | +| 10 | Ajanta | 15 | 814 | +| 10 | Hampi | 23 | 1405 | +| 11 | Pune | 13 | 120 | +| 11 | Kutch | 14 | 1098 | +| 11 | Goa | 16 | 411 | +| 12 | Varanasi | 4 | 1300 | +| 12 | Darjeeling | 5 | 635 | +| 13 | Jaipur | 2 | 1156 | +| 13 | Delhi | 3 | 1426 | +| 13 | Mahabaleshwar | 11 | 120 | +| 13 | Ajanta | 15 | 334 | +| 13 | Goa | 16 | 463 | +| 13 | Hyderabad | 20 | 552 | +| 13 | Hampi | 23 | 538 | +| 14 | Jaipur | 2 | 854 | +| 14 | Mahabaleshwar | 11 | 1098 | +| 15 | Pune | 13 | 334 | +| 15 | Khajuraho | 10 | 814 | +| 16 | Mahabaleshwar | 11 | 411 | +| 16 | Pune | 13 | 463 | +| 16 | Hampi | 23 | 320 | +| 17 | Coorg | 18 | 438 | +| 17 | Ooty | 21 | 237 | +| 17 | Bangalore | 25 | 441 | +| 17 | Kanniyakumari | 24 | 364 | +| 18 | Ooty | 21 | 246 | +| 18 | Munnar | 17 | 438 | +| 18 | Mysore | 22 | 118 | +| 19 | Madurai | 1 | 368 | +| 19 | Bangalore | 25 | 446 | +| 20 | Madurai | 1 | 991 | +| 20 | Pune | 13 | 552 | +| 20 | Ooty | 21 | 820 | +| 20 | Bangalore | 25 | 621 | +| 21 | Munnar | 17 | 237 | +| 21 | Coorg | 18 | 438 | +| 21 | Hyderabad | 20 | 820 | +| 21 | Mysore | 22 | 125 | +| 21 | Bangalore | 25 | 358 | +| 22 | Ooty | 21 | 125 | +| 22 | Coorg | 18 | 118 | +| 22 | Hampi | 23 | 394 | +| 22 | Bangalore | 25 | 158 | +| 23 | Delhi | 3 | 1872 | +| 23 | Kanha NP | 8 | 1122 | +| 23 | Kajhuraho | 10 | 1405 | +| 23 | Pune | 13 | 538 | +| 23 | Goa | 16 | 320 | +| 23 | Mysore | 22 | 394 | +| 23 | Bangalore | 25 | 341 | +| 24 | Madurai | 1 | 259 | +| 24 | Munnar | 17 | 364 | +| 25 | Madurai | 1 | 446 | +| 25 | Delhi | 3 | 2190 | +| 25 | Munnar | 17 | 441 | +| 25 | Pondicherry | 19 | 359 | +| 25 | Hyderabad | 20 | 621 | +| 25 | Ooty | 21 | 358 | +| 25 | Mysore | 22 | 158 | +| 25 | Hampi | 23 | 341 | ++----------+---------------------+----------+------+ +96 rows in set (0.01 sec) + +mysql> select * from user; ++-----------+-------------------+----------+ +| user_name | mail_id | password | ++-----------+-------------------+----------+ +| Disha | disha78@mail.com | dis@123 | +| Mrunal | mrunal05@mail.com | mru@123 | +| Mukta | mukta25@mail.com | muk@123 | +| Riya | riya45@mail.com | riy@123 | +| Sakshi | sakshi96@mail.com | sak@123 | +| Tanaya | tanaya12@mail.com | tan@123 | ++-----------+-------------------+----------+ +6 rows in set (0.00 sec) + +mysql> select * from location; ++----------+---------------+-------+ +| city_idx | city_name | state | ++----------+---------------+-------+ +| 1 | Madurai | TN | +| 2 | Jaipur | RJ | +| 3 | Delhi | ND | +| 4 | Varanasi | UP | +| 5 | Darjeeling | WB | +| 6 | Ladakh | LL | +| 7 | Manali | HP | +| 8 | Kanha NP | MP | +| 9 | Amritsar | PB | +| 10 | Khajuraho | MP | +| 11 | Mahabaleshwar | MH | +| 12 | Kaziranga NP | AS | +| 13 | Pune | MH | +| 14 | Kutch | GJ | +| 15 | Ajanta | MH | +| 16 | Goa | GA | +| 17 | Munnar | KL | +| 18 | Coorg | KT | +| 19 | Pondicherry | PD | +| 20 | Hyderabad | TL | +| 21 | Ooty | TN | +| 22 | Mysore | KT | +| 23 | Hampi | KT | +| 24 | Kanniyakumari | TL | +| 25 | Banglore | KT | ++----------+---------------+-------+ +25 rows in set (0.01 sec) + +mysql> \ No newline at end of file diff --git a/Team-CodeBlooded-Trip_Planner/Main.java b/Team-CodeBlooded-Trip_Planner/Main.java new file mode 100644 index 0000000..e4809aa --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/Main.java @@ -0,0 +1,8 @@ +package trip; + +public class Main { + public static void main(String[] args) { + Backend b = new Backend();//Calling backend + b.call(); + } +} diff --git a/Team-CodeBlooded-Trip_Planner/Node.java b/Team-CodeBlooded-Trip_Planner/Node.java new file mode 100644 index 0000000..424de8a --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/Node.java @@ -0,0 +1,13 @@ +package trip; +public class Node {//LOCATION DETAILS + int dest; + int wt; + Node next; + + Node(int dest, int wt) { + this.dest = dest;//END LOCATION + this.wt = wt;//DISTANCE + next = null; + } +} + diff --git a/Team-CodeBlooded-Trip_Planner/Readme.md b/Team-CodeBlooded-Trip_Planner/Readme.md new file mode 100644 index 0000000..e59e7f5 --- /dev/null +++ b/Team-CodeBlooded-Trip_Planner/Readme.md @@ -0,0 +1,43 @@ +## Team Members: +### Mrunal Jambenal – 2359 +### Sakshi Khaire – 2371 +### Tanaya Khaire – 2372 + +## Description: +We have created a mini trip planner using graph data structure. User +can signup using user name , unique email id and password and login +using the same. User can determine the trip cost and distance +between any two locations in the database. User can get +recommendations based on direct travel routes. + +## Technologies: +### Java – Object oriented language , Collection Framework +### MySQL – Storing Database + +## Tools: +### Eclipse IDE + +## Data Structures used: +### Graph +### ArrayList +### Queue + +## Classes: +### Main – This is the main class where the backend is called +### User – Contains constructor of user name , email id and password +### Node – Node for graph. Contains destination and distance. +### App – Methods for login, signup and logout. +### Graph – Dijkstra’s algorithm for shortest path and BFS for traversal +### Backend - Connection to database and retrieval of data. Menu options + +## SQL Tables: +### User table +#### Attributes: user_name, mail_id, password This table contains user information. +### Connloc +#### Attributes : city_idx ,Connected_Locations, conn_idx , dist This table contains connections between two cities with their name and index +### Location +#### Attributes: city_idx , city_name, state This table contains city index, name and state + + +## [Demonstration Video Link](https://drive.google.com/file/d/1ZO4kxKqQDYuauODMspoGble2CVp9fEjv/view?usp=sharing) +