Hi i am trying to create a keyboard input menu that displays the following. I am not quite sure how to go about doing this

1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit

I am not quite sure how to go about doing this. I have created a circle, rectangle, and triangle class, i am just having trouble making a flow menu, in the main driver.

And what are you working on right now, an Applet or a normal GUI Application, I may not be able to help you but the information at least helps others know what you actually are trying to achieve.

I am using the program Eclipse, so i believe it is an applet.

Eclipse is an IDE which should be used only by programmers who have achieved at least a little proficiency in the language.
If you are just beginning out (which seems to be the case) I recommend the IDE JCreator Lite Edition.

so i believe it is an applet.

For an Applet your class will either extend the Applet class or the JApplet class, If its an application you will have at least one class with a main method.

I am using the program Eclipse, so i believe it is an applet.

I'm a NetBeans guy (never used Eclipse), but I'm pretty sure Eclipse can do Applets and regular old non-Applet JFrames.

Regardless, what exactly do you want to have happen? Are you trying to have a JMenuBar with those four options so that you can pull down and select from them?

This is a sample run that i created of i would like happen.
1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit
make your selection: 1

Enter radius of the circle: 3
Area = 28.27
Perimeter = 18.85

1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit
make your selection: 2

Enter width of the rectangle: 3
Enter height of the height: 4
Area = 12.0
Perimeter = 14.0

1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit
make your selection: 3

Enter base of the triangle: 2
Enter height of the triangle: 5
Area = 5.0

1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit
make your selection: 3

Enter base of the triangle: 1
Enter height of the triangle: 2
Area = 1.0

1) Work with a circle
2) Work with a rectangle
3) Work with a triangle
4) Exit
make your selection: 5
Invalid entry, try again: 0
Invalid entry, try again: 4

You made 5 choices from the menu.
good bye!

I apologize if this information does not help, I just started programming a couple months ago and needless to say i am a hardcore newbie.

So this is a console project, not a GUI project, correct? Therefore it would not be an Applet.

I assume you are familiar with System.out.println for output. Do you know how to accept input from the console? Here is some sample code if you do not.

http://www.java-tips.org/java-se-tips/java.util/how-to-read-input-from-console.html

If you know how to read from and display to the console, what problems are you having?

Sorry I have no clue what the difference is between a GUI project and an applet. I know how to use println, I am confused on how to make the whole menu in general. I don't understand how to exactly write a code to allow the user make a selection from the menu, than have it pull up the information to input the values, and then return back to the menu.

A GUI project/application/program is one where you present a Graphical User Interface such as a Window or form with buttons, textboxes, labels, images etc., where the user communicates with the system with the help of graphical components such as the press of a button, writing of text in text box, selecting/deselcting of a checkbox/radio button, selection of tabs etc as apart from a console based application where a user enters various commands to communicate with the application. Take the simple example of a file creation in a GUI versus a console based application. To create a text file you would hurriedly go to notepad (on windows) or a text editor like gedit and click New from the File menu and start typing the text in the file. To create the same file through console you would have to go to the DOS prompt (or a command shell ) and type "COPY CON filename" then type the file text and then say ^Z to save it. The difference is evident in the GUI method you pretty much do everything with the click of the mouse and press of buttons and coosing of options, in the console based method you have type commands for all things, not to mention the graphical method makes life a whole lot easier for a user.

Now moving towards applet, applets are small applications that run inside the scope of a browser. These aren't typical run from the console, though you can do that through the 'appletviewer'. But the typical usage for them lies in running in the scope of a browser. To give an example of an applet, well, if you have ever visited a tax site and it has a tax calculator it would most probably be written in java and would run as an applet. Applets are embedded in HTML file using the applet tag, whenever the browser encounters an <applet ...> tag it makes a requests for the applet to the server the same way it would make request for an image on encountering and <img...> tag.

Now towards your code, to write a menu driven code what you could do is present the user with a menu such as
1. Work with a Circle
2. Work with a Rectangle
3. Work with a Triangle
4. Exit

Then in the program handle the options as follows:

while(true) // this will keep your program running, only when the user inputs the value for 'exit' the program will exit.
{
    if (option == 1){
        // code to work with a circle
    }
    else if (option == 2){
        // code to work with a rectangle
    }
    else if (option == 3){
        // code to work with a triangle 
    } 
    else if (option == 4){
        System.out.println("You asked to 'exit' and thats just what I will do.");
        System.exit(0);
    }
    else{
        System.out.println("You have entered a wrong input");
    }
}
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.