Submitted by donbermoy on Monday, May 19, 2014 - 19:23.
In this tutorial, i will teach you how to create a program that converts an inputted decimal number into binary using Java GUI.
So, now let's start this tutorial!
1. Open JCreator or NetBeans and make a java program with a file name of decToBinary.java.
2. Import javax.swing package. Hence we will use a GUI (Graphical User Interface) here like the inputting the decimal number.
importjavax.swing.*;
3. Initialize your variables in your Main, variable numInput as string and make it as an inputdialogbox. Variable n as integer that will parse the inputted value of numInput. And variable binary as integer that will hold the binary value of our input.
JOptionPane.showMessageDialog(null, "Binary equivalent is: "+binary);
}
}
Hope this program helps! :)
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
If you have some queries, feel free to contact the number or e-mail below.
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware