Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.sql.*;
- import java.util.Scanner;
- public class Connect_to_SQL {
- static Scanner in1 = new Scanner(System.in);
- public static void CleanUp(){
- in1.close();
- }
- //display the tables
- public static void displayPerson(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT * FROM Person");
- System.out.println("Person Database");
- System.out.println("-------------------------------------");
- while(rs.next()){
- String Person_ID = rs.getString(1);
- String First_Name = rs.getString(2);
- String Last_Name = rs.getString(3);
- String DOB = rs.getString(4);
- String Role = rs.getString(5);
- System.out.println(Person_ID + " " + First_Name + " " + Last_Name + " " + DOB + " " + Role);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayMovies(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT * FROM Movies");
- System.out.println("Movie Database");
- System.out.println("-------------------------------------");
- while(rs.next()){
- String Movie_ID = rs.getString(1);
- String Title = rs.getString(2);
- String Year = rs.getString(3);
- String Genre = rs.getString(4);
- System.out.println(Movie_ID + " " + Title + " " + Year + " " + Genre);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayActs_In(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT * FROM Acts_In");
- System.out.println("Acts_In Database");
- System.out.println("-------------------------------------");
- while(rs.next()){
- String Person_ID = rs.getString(1);
- String Movie_ID = rs.getString(2);
- System.out.println(Person_ID + " " + Movie_ID );
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayDirects_In(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT * FROM Directs_In");
- System.out.println("Directs_In Database");
- System.out.println("-------------------------------------");
- while(rs.next()){
- String Person_ID = rs.getString(1);
- String Movie_ID = rs.getString(2);
- System.out.println(Person_ID + " " + Movie_ID );
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- //display the dynamic queries
- public static void displayDQuery1(){
- //Connect to SQL
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN (SELECT Acts_In.Movie_ID FROM Acts_In, Person WHERE Person.First_Name = '" + fname + "' "
- + "AND Person.Last_Name = '" + lname + "' "
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') AND Person.Person_ID = Acts_In.Person_ID);");
- System.out.println("The List of Movies are as follows: ");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayDQuery2(){
- //Connect to SQL
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN (SELECT Movie_ID FROM"
- + "(SELECT * FROM Acts_In NATURAL JOIN Person WHERE Person.First_Name = '" + fname + "' "
- + "AND Person.Last_Name = '" + lname + "' " + " AND Job = 'Both') AS S NATURAL JOIN Directs_In);");
- System.out.println("The List of Movies are as follows: ");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayDQuery3(){
- //Connect to SQL
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN "
- + "(SELECT Acts_In.Movie_ID FROM Acts_In, Person "
- + "WHERE Person.First_Name = '" + fname + "' " + "AND Person.Last_Name = '" + lname + "' "
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') "
- + "AND Person.Person_ID = Acts_In.Person_ID) AND Year >= 2000 AND Genre = 'Thriller';");
- System.out.println("The list of movies are as follows:");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayDQuery4(){
- //Connect to SQL
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT S3.First_Name, S3.Last_Name FROM "
- + "(SELECT DISTINCT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In "
- + "WHERE First_Name = '" + fname + "' " + " AND Last_Name = '" + lname + "' " + " AND "
- + "(Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Acts_In) "
- + "AS S2 NATURAL JOIN Person AS S3, Person "
- + "WHERE Person.First_Name = '" + fname + "' " + " AND Person.Last_Name = '" + lname + "' "
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') "
- + "AND S3.DOB >= date_add(Person.DOB, INTERVAL 10 year);");
- System.out.println("The list of all co actors are as follows:");
- while(rs.next()){
- String First = rs.getString(1);
- String Last = rs.getString(1);
- System.out.println(First + " " + Last);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displayDQuery5(){
- //Connect to SQL
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT First_Name, Last_Name FROM (SELECT Person_ID, Max(c) AS Maxc FROM ( SELECT Person_ID, count(Person_ID) c FROM (SELECT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In WHERE First_Name = '" + fname + "' " + " AND Last_Name = '" + lname + "' " + " AND (Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Directs_In) AS S1 GROUP BY Person_ID) AS S2 NATURAL JOIN Person GROUP BY Person_ID) AS S3 NATURAL JOIN Person WHERE Maxc IN (SELECT Max(c) AS Maxc FROM (SELECT Person_ID, count(Person_ID) c FROM (SELECT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In WHERE First_Name = '" + fname + "' " + " AND Last_Name = '" + lname + "' " + " AND (Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Directs_In) AS S1 GROUP BY Person_ID) AS S2 NATURAL JOIN Person);");
- System.out.println("The name of the director is as follows:");
- while(rs.next()){
- String First = rs.getString(1);
- String Last = rs.getString(2);
- System.out.println(First + " " + Last);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- //display static queries
- public static void displaySQuery1(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN (SELECT Acts_In.Movie_ID FROM Acts_In, Person WHERE Person.First_Name = \'Sharukh\'"
- + "AND Person.Last_Name = \'Khan\'"
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') AND Person.Person_ID = Acts_In.Person_ID);");
- System.out.println("The List of Movies are as follows: ");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displaySQuery2(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN (SELECT Movie_ID FROM"
- + "(SELECT * FROM Acts_In NATURAL JOIN Person WHERE Person.First_Name = 'Sharukh' "
- + "AND Person.Last_Name = 'Khan' AND Job = 'Both') AS S NATURAL JOIN Directs_In);");
- System.out.println("The List of Movies are as follows: ");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displaySQuery3(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT Title FROM Movies WHERE Movie_ID IN "
- + "(SELECT Acts_In.Movie_ID FROM Acts_In, Person "
- + "WHERE Person.First_Name = 'Sharukh' AND Person.Last_Name = 'Khan' "
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') "
- + "AND Person.Person_ID = Acts_In.Person_ID) AND Year >= 2000 AND Genre = 'Thriller';");
- System.out.println("The list of movies are as follows:");
- while(rs.next()){
- String Title = rs.getString(1);
- System.out.println(Title);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displaySQuery4(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT S3.First_Name, S3.Last_Name FROM "
- + "(SELECT DISTINCT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In "
- + "WHERE First_Name = 'Sharukh' AND Last_Name = 'Khan' AND "
- + "(Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Acts_In) "
- + "AS S2 NATURAL JOIN Person AS S3, Person "
- + "WHERE Person.First_Name = 'Sharukh' AND Person.Last_Name = 'Khan' "
- + "AND (Person.Job = 'Actor' OR Person.Job = 'Both') "
- + "AND S3.DOB >= date_add(Person.DOB, INTERVAL 10 year);");
- System.out.println("The list of all co actors are as follows:");
- while(rs.next()){
- String First = rs.getString(1);
- String Last = rs.getString(1);
- System.out.println(First + " " + Last);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void displaySQuery5(){
- //Connect to SQL
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- ResultSet rs = s1.executeQuery("SELECT First_Name, Last_Name FROM (SELECT Person_ID, Max(c) AS Maxc FROM ( SELECT Person_ID, count(Person_ID) c FROM (SELECT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In WHERE First_Name = 'Sharukh' AND Last_Name = 'Khan' AND (Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Directs_In) AS S1 GROUP BY Person_ID) AS S2 NATURAL JOIN Person GROUP BY Person_ID) AS S3 NATURAL JOIN Person WHERE Maxc IN (SELECT Max(c) AS Maxc FROM (SELECT Person_ID, count(Person_ID) c FROM (SELECT Person_ID FROM (SELECT Movie_ID FROM Person NATURAL JOIN Acts_In WHERE First_Name = 'Sharukh' AND Last_Name = 'Khan' AND (Person.Job = 'Actor' OR Person.Job = 'Both')) AS S1 NATURAL JOIN Directs_In) AS S1 GROUP BY Person_ID) AS S2 NATURAL JOIN Person);");
- System.out.println("The name of the director is as follows:");
- while(rs.next()){
- String First = rs.getString(1);
- String Last = rs.getString(2);
- System.out.println(First + " " + Last);
- }
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void fireStaticQueries() throws IOException{
- int menu_option;
- String cont;
- do{
- System.out.println("-------------Static Queries Menu---------------");
- System.out.println("Enter 1 to display list of all the films in which an actor with first name \"Sharukh\" and last name \"Khan\" acted");
- System.out.println("Enter 2 to display list of all movies for which \"Sharukh\" \"Khan\" was an actor as well as director");
- System.out.println("Enter 3 to display list of all \"Thrillers\" released after the year 2000 in which \"Sharukh\" \"Khan\" acted.");
- System.out.println("Enter 4 to display List all Co-actors of \"Sharukh\" \"Khan\" who are younger than him by 10 years");
- System.out.println("Enter 5 to display the Director in whose movie \"Sharukh\" \"Khan\" acted most number of times");
- menu_option = in1.nextInt();
- if(menu_option == 1){
- displaySQuery1();
- }
- else if(menu_option == 2){
- displaySQuery2();
- }
- else if(menu_option == 3){
- displaySQuery3();
- }
- else if(menu_option == 4){
- displaySQuery4();
- }
- else if(menu_option == 5){
- displaySQuery5();
- }
- else{
- System.out.println("You have entered a wrong choice");
- }
- //Scanner in2 = new Scanner(System.in);
- System.out.println("Do you wish to continue(yes/no)");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- cont = br.readLine();
- }while(cont.equals("yes"));
- System.out.println("Returning to the main menu...");
- System.out.println("--------------------------------------------------------------");
- }
- public static void fireDynamicQueries() throws IOException{
- int menu_option;
- String cont;
- do{
- System.out.println("-------------Dynamic Queries Menu---------------");
- System.out.println("Enter 1 to display list of all the films in which an actor acted");
- System.out.println("Enter 2 to display list of all movies for which an actor was an actor as well as director");
- System.out.println("Enter 3 to display list of all \"Thrillers\" released after the year 2000 in which an actor acted.");
- System.out.println("Enter 4 to display List all Co-actors of an actor who are younger than him by 10 years");
- System.out.println("Enter 5 to display the Director in whose movie an actor acted most number of times");
- menu_option = in1.nextInt();
- if(menu_option == 1){
- displayDQuery1();
- }
- else if(menu_option == 2){
- displayDQuery2();
- }
- else if(menu_option == 3){
- displayDQuery3();
- }
- else if(menu_option == 4){
- displayDQuery4();
- }
- else if(menu_option == 5){
- displayDQuery5();
- }
- else{
- System.out.println("You have entered a wrong choice");
- }
- //Scanner in2 = new Scanner(System.in);
- System.out.println("Do you wish to continue(yes/no)");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- cont = br.readLine();
- }while(cont.equals("yes"));
- System.out.println("Returning to the main menu...");
- System.out.println("--------------------------------------------------------------");
- }
- //insert queries
- public static void insertPerson(){
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the first name of the actor for which you wish to fire the queries:");
- String fname = br.readLine();
- System.out.println("Enter the last name of the actor for which you wish to fire the queries:");
- String lname = br.readLine();
- System.out.println("Enter the DOB of the actor for which you wish to fire the queries:");
- String dob = br.readLine();
- System.out.println("Enter the role of the actor for which you wish to fire the queries:(1/2/3)");
- String role = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- s1.executeUpdate("INSERT INTO Person VALUES(null,'" + fname + "' " + ", '" + lname + "' " + ",'" + dob + "' " + ", " + role + ");");
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void insertMovies(){
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the title of the movie for which you wish to fire the queries:");
- String title = br.readLine();
- System.out.println("Enter the year of the movie for which you wish to fire the queries:");
- String year = br.readLine();
- System.out.println("Enter the genre of the movie for which you wish to fire the queries:");
- String genre = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- s1.executeUpdate("INSERT INTO Movies VALUES(null,'" + title + "' " + ", '" + year + "' " + ",'" + genre + "' " + ");");
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void insertActs_In(){
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the Person_ID for which you wish to fire the queries:");
- String p = br.readLine();
- System.out.println("Enter the Movie_ID for which you wish to fire the queries:");
- String m = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- s1.executeUpdate("INSERT INTO Acts_In VALUES('" + p + "' " + ", '" + m + "' " + ");");
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- public static void insertDirects_In(){
- try{
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println("Enter the Person_ID for which you wish to fire the queries:");
- String p = br.readLine();
- System.out.println("Enter the Movie_ID for which you wish to fire the queries:");
- String m = br.readLine();
- Class.forName("com.mysql.jdbc.Driver");
- Connection c1 = null;
- c1 = DriverManager.getConnection("jdbc:mysql://10.5.18.68/13CS30041","13CS30041", "cse12");
- Statement s1 = c1.createStatement();
- s1.executeUpdate("INSERT INTO Directs_In VALUES('" + p + "' " + ", '" + m + "' " + ");");
- c1.close();
- }catch(Exception e){ System.out.println(e);}
- }
- //main
- public static void main(String[] args) throws IOException {
- // TODO Auto-generated method stub
- //System.out.println("Hello!");
- int menu_option;
- String cont;
- do{
- System.out.println("-------------Menu---------------");
- System.out.println("Enter 1 to display Person Table");
- System.out.println("Enter 2 to display Movies Table");
- System.out.println("Enter 3 to display Acts_In Table");
- System.out.println("Enter 4 to display Directs_In Table");
- System.out.println("Enter 5 to fire Static Queries");
- System.out.println("Enter 6 to fire Dynamic Queries");
- System.out.println("Enter 7 to insert into Person Table");
- System.out.println("Enter 8 to insert into Movies Table");
- System.out.println("Enter 9 to insert into Acts_In Table");
- System.out.println("Enter 10 to insert into Directs_In Table");
- menu_option = in1.nextInt();
- //in1.close();
- if(menu_option == 1){
- displayPerson();
- }
- else if(menu_option == 2){
- displayMovies();
- }
- else if(menu_option == 3){
- displayActs_In();
- }
- else if(menu_option == 4){
- displayDirects_In();
- }
- else if(menu_option == 5){
- fireStaticQueries();
- }
- else if(menu_option == 6){
- fireDynamicQueries();
- }
- else if(menu_option == 7){
- insertPerson();
- }
- else if(menu_option == 8){
- insertMovies();
- }
- else if(menu_option == 9){
- insertActs_In();
- }
- else if(menu_option == 10){
- insertDirects_In();
- }
- else{
- System.out.println("You have entered a wrong choice");
- }
- //Scanner in2 = new Scanner(System.in);
- System.out.println("Do you wish to continue(yes/no)");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- cont = br.readLine();
- }while(cont.equals("yes"));
- System.out.println("Exiting...");
- System.out.println("--------------------------------------------------------------");
- CleanUp();
- }
- }
Add Comment
Please, Sign In to add comment