Definitely Work - Flat Build Wide Program with JOptionPane - Java Netbeans
Hello Guys, meet again with this handsome mimin, this time mimin will discuss which is quite deviating from the theme of this website. This is also one of the ways Mimin helps fellow students to understand the Java programming language. Let’s see.
Also Read:
Program Calculating Area of Flat Shapes (Triangles, Rectangles and Circles) with JOptionPane – Java Netbeans – First to make this program, you must have the netbeans application, which you can download here DOWNLOAD NETBEANS.
Choose according to the operating system you are using, because the tutorial for installing NetBeans has been discussed a lot on other websites. so yeah you guys are browsing alone 😀
How to Create a Flat Shape Area Calculator Using JOptionPane – Java Netbeans :
First :
Create a New Project in the menu Bar (File), then select New Project. You can also create a new project by pressing the Shortcut key (Ctrl + Shift + N) on the keyboard.
Creating a New Project |
Second :
On Menu Choose Project please select a folder Javathen select Java Applications. then it will continue with the following display. You can make a name according to your wishes.
On the menu, please Uncheck or leave Check on Create Main Classwhich means later in the project will create a name Play Class automatically. don’t forget, also specify the folder where the project will be saved later or you can leave it by default.
Third :
For Java Class new, by right-clicking on the project earlier and selecting New then select Java Class.
Now in the java class you will write the program.
Creating Main Class in Project – Java Netbeans |
Fourth :
Enter Program code Calculating flat shapes with JOptionPane – with Netbeans application Java programming language
—=== Copy the code below ===—
/*
Created BY : Masibnu.com beginner Programmer
*/
task package3;
import javax.swing.JOptionPane;
/**
* @author IBNU
*/
public class ProgramBuildFlat {
public static void main(String[] args) {
//declare
input strings;
int LP, LS, LL;
double LuPer, LuSeg, LuLing, phi, half;
pi = 3.14;
half = 0.5;
//Programs
JOptionPane.showMessageDialog(null, “Welcome to the Program \nThe Flat Shape Area Counter”);
input = JOptionPane.showInputDialog(“Select Flat Build : \n”
+ “1. Area of Rectangle \n”
+ “2. Area of Triangle \n”
+ “3. Area of Circle”);
//parse
LP = Integer.parseInt(input);
LS = Integer.parseInt(input);
LL = Integer.parseInt(input);
//Process
if (LP == 1) {
String Lper = “”;
Lper = JOptionPane.showInputDialog(“Enter Square Area \n”);
intLengthSquare = Integer.parseInt(Lper);
String Pper = “”;
Pper = JOptionPane.showInputDialog(“Enter Rectangle \n”);
intSquareWidth = Integer.parseInt(Pper);
LuPer = length of square * width of square;
JOptionPane.showMessageDialog(null, “Area is : ” + LuPer + ” cm”);
} else if (LS == 2) {
String Aseg = “”;
Aseg = JOptionPane.showInputDialog(“Enter Length of Triangle \n”);
int BaseTriangle = Integer.parseInt(Aseg);
String Tseg = “”;
Tseg = JOptionPane.showInputDialog(“Enter the Height of Triangle \n”);
intHeightTriangle = Integer.parseInt(Tseg);
LuSeg = half * Base of Triangle * Height of Triangle;
JOptionPane.showMessageDialog(null, “Area is : ” + LuSeg + ” cm”);
} else if (LL == 3) {
String Link = “”;
JaLing = JOptionPane.showInputDialog(“Enter Circle Length : \n”);
intCircleRing = Integer.parseInt(Ling);
LuLing = phi * (int) Math.pow(Finger Circle,2);
JOptionPane.showMessageDialog(null, “The area of the circle is : ” + LuLing + ” cm”);
} else
JOptionPane.showMessageDialog(null, “Enter Number According to Options”);
}
}
—=== End of Program Code ===—
Please Copy all the blue program codes above then Paste (Paste) on the main Class on your Netbeans.
If there are errors or problems, please ask directly in the comments column or to Facebook.com/dieasid.
That’s my article about the Program Calculating Flat Shapes with JOptionPane – Java Netbeans, good luck 🙂