Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help to remove error ...

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help to remove error ...

    import java.io.*;

    class Area throws IOException
    {

    BufferedReader br = new BufferedReader( new InputStreamReader (System.in));
    double area;
    try
    {


    void getdata()

    {

    System.out.println (" Enter the Choice ");
    System.out.println(" You want to Find area of ");
    System.out.println(" 1. Circle \n 2. Rectangle \n3. Square ");
    int Choice ;
    char ans= 'y';

    while (ans=='y')
    {
    System.out.println(" Enter Choice");

    Choice = br.read();
    switch (Choice)
    {

    case 1:
    /*int r;
    System.out.println(" Enter the Radius of the Circle");
    r=br.read();*/
    circle();
    //System.out.println("Area is "+area);

    case 2:

    System.out.println(" Enter the side of the Rectangle ");
    int l=br.read();
    int b=br.read();
    rect(l,b);
    System.out.println("Area is "+area);

    case 3:
    int s;
    System.out.println("Enter the side of square ");
    s=br.read();
    sqr(s);
    System.out.println("Area is "+area);
    case 4:
    System.out.println(" You have Entered Wrong Choice");

    }

    System.out.println(" Did you want to try Again ,Enter Y/N");
    ans=(char)br.read();


    }

    }


    void circle()
    {
    int r;
    System.out.println(" Enter the Radius of the Circle");
    r=br.read();
    //circle (r);

    area=3.14*r*r;
    System.out.println("Area is "+area);

    //return area ;
    }

    double rect(int l,int b)
    {
    area=l*b;
    return area;
    }

    double sqr(int side)
    {

    area =side*side;
    return area;
    }
    }

    catch (Exception e)
    {
    }

    }

    class Areamain
    {
    public static void main (String arg[])
    {
    Area sc = new Area();
    sc.getdata();
    }
    }


  2. #2
    Junior Member
    Join Date
    Oct 2013
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help to remove error ...

    Your code is very messy, over-complicated and full of mistakes + junk code. Try re-writing a simplified version of the code.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Help to remove error ...

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    Also copy the full text of the error message and pasted it here.
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Help to remove error ...

    What error? You should always include the full error message with your code.
    Improving the world one idiot at a time!

Similar Threads

  1. how to remove NullPointerException
    By saurabh_kabra in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 29th, 2013, 09:17 AM
  2. i am new to java plzz help to remove error in this programme
    By akshay1991 in forum AWT / Java Swing
    Replies: 1
    Last Post: August 28th, 2012, 09:00 AM
  3. Adding add/remove button to add/remove tab
    By JMtrasfiero in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 27th, 2012, 11:24 AM
  4. not able to remove from ArrayList
    By harsha_c in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 3rd, 2011, 03:28 AM
  5. How to remove letters
    By noobish in forum Java Theory & Questions
    Replies: 13
    Last Post: October 3rd, 2009, 10:36 PM