Skip to main content

Posts

Showing posts from July, 2013

gui calculator design in java

gui calculator design /* // Program for a calculator// import java.awt.*; import java.awt.event.*; import javax.swing.*; class Calculator extends JFrame implements ActionListener {     JTextField txt;     JButton btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn10,btn11,btn12,btn13,btn14,btn15,btn16,btn17,btn18,btn19;          String s1="",s2="",s3="",s4="",s5="";       double n1=0;       int t=0; int d=0;     Calculator()     {             txt=new JTextField(20);             btn1=new JButton("1");             btn2=new JButton("2");       btn3=new JButton("3");       btn4=new JButton("4");       btn5=new JButton("5");       bt...
SignUp Millionare.com login now we produce millionares just in a moment ,not through magic but for your talent. Registor Now ! User Name                Gender                      Male Female Password                   Confirm Password   Birthday:                  Month: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Year: 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2000 1999 1998 1997 1996 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1...

Taking input using BufferedReader class in java and converting them using parse statement

/**Taking input using BufferedReader class in java*/ //Sum.java //note:Remove the double backslash before import and both int statements before compilation //import java.io.*; public class Sum {      public static void main(String [] args)throws IOException      {           BufferedReader br = new BufferedReader(new InputStreamReader(System.in));           // int a = Integer.parseInt(br.readLine());           // int b = Integer.parseInt(br.readLine());            System.out.println("Sum of" +a+"and" +b+ "="+(a+b) );          } } 

Taking integer input using Scanner class

//Sum.java /** Find the sum of two numbers taking input using Scanner class */ //note: remove the double back slash before import package before compilation //import java.util.Scannner; public class Sum {     public static void main(String [] args)     {           Scanner input  = new Scanner(System.in);           int a = input.nextInt();           int b = input.nextInt();           System.out.println(" sum of "+a+ "and"+b+" = "+(a+b));     } } /* note: if you want to take input in double or float just     use float a = input.nextfloat(); or         double a = input.nextDouble(); */ 

sum of two numbers

//Sum.java /** To find the sum of two given numbers in java code */ public class Sum {     public static void main(String [] args)     {              int a =7;                    int b =5;          System.out.println("sum of "+a+"and"+b+"="+(a+b));     } } 

HelloWorld

//HelloWorld.java /** Write a program to print ! Hello World in your console in java*/ public class HelloWorld {        public static void main(String [] args)        {             System.out.println("! Hello World");        } }