Can't get this correct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NAVEEN1996
    New Member
    • Mar 2010
    • 1

    Can't get this correct

    I cant get this java program to work.Can anyone please tell me what the problem about this is and what should I do to correct it.



    import java.io.*;
    public class Wishes
    {
    public static void main(String args[])throws IOExceptation
    {
    int c;
    InputStreamRead er read = new InputStreamRead er(system.in);
    BufferedReader in = new BufferedReader( read);
    System.out.prin tln("1 for Good Morning, 2 for Good afternoon, 3 for Good Evening, 4 for Good night");
    System.out.prin tln("3");
    c=Integer.parse Int(in ReadLine());
    switch(c)
    case 1:
    System.out.prin tln("Good Morning");
    break;
    case 2:
    System.out.prin tln("Good Afternoon");
    break;
    case 3:
    System.out.prin tln("Good Evening");
    break;
    case 4:
    System.out.prin tln("Good Night");
    break;
    Default
    System.out.prin tln("It is a wrong choice");
    }
    }
  • anurag275125
    New Member
    • Aug 2009
    • 79

    #2
    You have done many syntactical error in your program.
    Use the code below and find out the errors in yours code---

    Code:
    import java.io.*;
    public class Wishes
    {
    	public static void main(String args[])throws IOException
    	{
    		int c;
    		InputStreamReader read = new InputStreamReader(System.in);
    		BufferedReader in = new BufferedReader(read);
    		System.out.println("1 for Good Morning, 2 for Good afternoon, 3 for Good Evening, 4 for Good night");
    		System.out.println("3");
    		c=Integer.parseInt(in.readLine());
    		switch(c)
    		{
    			case 1:
    				System.out.println("Good Morning");
    				break;
    			case 2:
    				System.out.println("Good Afternoon");
    				break;
    			case 3:
    				System.out.println("Good Evening");
    				break;
    			case 4:
    				System.out.println("Good Night");
    				break;
    			default:
    				System.out.println("It is a wrong choice");
    		}
    	}
    }

    Comment

    Working...