I want to found more of area for (circle, square ..etc )

I'm using ( switch method).

I read ( radius ,length ,width ,base and height ).

but when I enter Area of square . it want enter
( radius ,length ,width ,base and height )
I mean all thing ..

my question : how can I make my program order enter the required data ?
example , order for triangle ( base and height ) just !


I could understand you. You want your program to determine what are all the inputs required by the option and correspondingly it should ask new inputs from user.

eg for circle ---> input jus radius

for rectangle ----> input length and breadth

Am i rite ??????? . Well..... If so.... please see the following code

import java.io.*; 

class are{
  public static void main(String[] args) {
        BufferedReader object = new BufferedReader(
        new InputStreamReader(System.in));
        System.out.println("Please enter the option you desire");
        System.out.println(" 1. Area of circle ");
         System.out.println("2. Area of Square ");
          System.out.println("3. Area of reactangle ");
           System.out.println("4. Area of triangle ");

        int a= Integer.parseInt(object.readLine());
        case 1 :
           System.out.println("Enter the radius ");
            int r = Integer.parseInt(object.readLine());
            float area = 3.14 * r * r;
            System.out.println("The area of circle is "+area);
        case 2 :
           System.out.println("Enter the side ");
            int s = Integer.parseInt(object.readLine());
            float areas =  s * s;
            System.out.println("The area of circle is "+areas);
    catch (Exception e){
      System.out.println("Array out of bounds exaception");

So like the above code, code your program to ask input from the user depending upon the value chosen

Am i CLEAR??????



thank you (F)

yes , you are cleaning