Hello my question is fairly simple though I can't seem to find the solution. I'm writing a program that basically calculates the area of different shapes. I am making a seperate method per shape to do the calculations but in my main method I need to call the method according to what shape it is. I have the program ask which shape, how do i make it call the method the user inputs for?
I have the shapes listed like this :

        int 1 = triangle;
        int 2 = square;
        int 3 = rectangle;
        int 4 = trapezoid;
        int 5 = pentagon;
        int 6 = hexagon;
        int 7 = octagon;
        int 8 = circle;

        System.out.println("Enter the number of the shape you are calculating the are of.");
        System.out.println("1. Triangle");
        System.out.println("2. Square");
        System.out.println("3. Rectangle");
        System.out.println("4. Trapezoid");
        System.out.println("5. Pentagon");
        System.out.println("6. Hexagon");
        System.out.println("7. Octagon");
        System.out.println("8. Circle");
        keyboard.nextInt();

I have the methods written out, below in the program. I just need to know how to call the method. Any help would be much appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.