-2

i'm facing the error please help me sort it out,as i have my project to be submitted....please...

import java.util.*;

public class project
{        

public static void intro1()
{
    Scanner obj= new Scanner((System.in));
    System.out.println(" This converter will be related as follows" );
    System.out.println(" 1.Digital Storage" );
    System.out.println(" 2.Distance(length)" );
    System.out.println(" 3.Currency" );
    System.out.println(" 4.Temperature" );
    System.out.println(" Please choose your option,which you want to be converted,please type that number related" );
    int q= obj.nextInt();
    System.out.println(" Command received!....executing..." );
    String w=Integer.toString(q);
    String a=(w.trim());
    int n=Integer.parseInt(a);
    switch(n)
    {
        case 1:
        {
            //some codes here 
        }
        break;
        case 2:
        {
            //some codes here 

        }
        break;
        case 3:
        {

        }
        break;
        case 4:
        {
            //some codes here `enter code here`
        }
        break;

        default:
        {
            System.out.println(" I'm sorry you have chosen the wrong option...please enter again" );
            {
                intro1();
            }
        }
    }
    exit();
}

public static void exit()
{
    Scanner obj=new Scanner (System.in);
    System.out.println("to continue type 'cont' or else type 'exit'");
    String pi=obj.nextLine();
    if(pi=="exit")
    {
        System.exit(0);
    }
    else 
    {
        intro1();
    }
}
}

i'm facing the error please help me sort it out,as i have my project to be submitted....please...

MirMasej
  • 1,592
  • 12
  • 17
  • Welcome to Stack Overflow! Please see [ask] and [mcve]. Also see [homework](http://meta.programmers.stackexchange.com/questions/6166/open-letter-to-students-with-homework-problems) – Mat Oct 21 '16 at 12:25

1 Answers1

0

you just replace code

if(pi.equalsIgnoreCase("exit"))
    {
        System.exit(0);
    }
    else 
    {
        intro1();
    }

Or you can just simply add 5.Exit and write below condition

case 5:
        {
          System.exit(0);
          break;
        }
Keval Pithva
  • 600
  • 2
  • 5
  • 21