Tuesday, 8 December 2015

Area and circumfrence of circle

Area and circumfrence of circle
  • Open netbeans and make new application.
  • Open jFrame component and put the other components from pallet like given below:
  • We have kept two buttons:

    1.  Area
    2.  Perimeter
  • Now we will write the code of area button.
    • Code for area
  • Code is given below:
  • Here we have taken double method instead of integer because it is capable to work with higher numbers as well as decimals.
  • Declear variable.
  • Connect first text field.
  • Put the formula of area of circle which is πr×r  which we have written as a*a*22/7  where * is sign of multiply.
  • Put the result in result text field.
    • Code for perimeter

  • Code is given below:
  • Coding is like same as of area button but the difference is of formula.
  • Formula is 2×πr  which we have written as 2*a*22/7
  • Put the result in result text field.
  • Our program is ready.

Monday, 7 December 2015

Area and perimeter of rectangle

Area and perimeter of rectangle
  • Open netbeans and make new application.
  • Open jFrame component and put the other components from pallet like given below:
  • We have kept two buttons:

  1. Area
   2.  Perimeter
  • Now we will write the code of area button.
  • Code for area
  • Code is given below:
  • Here we have taken double method instead of integer because it is capable to work with higher numbers as well as decimals.
  • Declear variable.
  • Connect first text field.
  • Put the formula of area of rectangle which is length × bredth which we have written as a × b where * is sign of multiply.
  • Put the result in result text field.
  • Code for perimeter

  • Code is given below:
  • Coding is like same as of area button but the difference is of formula.
  • Formula is 2(L+B) which we have written as c=a+b and then d=2*c.
  • d is result.
  • Put the result in result text field.
  • Our program is ready.

Sunday, 6 December 2015

Area and perimeter of square

Area and perimeter of square
  • Open netbeans and make new application.
  • Open jFrame component and put the other components from pallet like given below:
  • We have kept two buttons:
  1. Area
  2. Perimeter
  • Now we will write the code of area button.
Code for area
  • Code is given below:
  • Here we have taken double method instead of integer because it is capable to work with higher numbers as well as decimals.
  • Declear variable.
  • Connect first text field.
  • Put the formula of area of square which is side × side which we have written as a* a where * is sign of multiply.
  • Put the result in result text field.
Code for perimeter
  • Code is given below:
  • Coding is like same as of area button but the difference is of formula.
  • Formula is side × 4 which we have written as a*4.
  • Put the result in result text field.
  • Our program is ready.

Wednesday, 4 November 2015

Age calculator

Age calculator
  • Open netbeans and new application.
  • Open new frame and drag the components and arrange them as given below
  • Here I have written the year 2020 you can write any year as your wish.
  • Open source code and write the code given below
  • Declear the variable and join the jTextField1 with a.
  • Here when we will subtract our birth year from the year till you want your age will provide the correct age you want.
  • Store this value in variable b and print it in next jTextField.
  • Now your program is ready.

Friday, 30 October 2015

Interchange two value without third variable

Interchange two values without third variable
  • Make new jFrame and add the components to frame like given in below figure.
  • Open source code and declear three variables a,b,c as integer and also type the code of text fields.
  • Type the code given below 
  • Now I will explain how java interchanges the value:

  1. Let a=10,b=20.
  2. Here a=a+b means a=10+20=30.
  3. Now value of a=30.
  4. Then b=a-b means b=30-20=10.
  5. Then a=a-b means a=30-10=20.
  6. So by this java interchanges the value.
  • Now print a & b.
  • Run the file and see what happens.

Thursday, 29 October 2015

Interchange two values with third variable

Interchange two values with third variable
  • Make new jFrame and add the components to frame like given in below figure.



  • Open source code and declear three variables a,b,c as integer and also type the code of text fields.
  • Type the code given below 
  • Now I will explain how java interchanges the value:
  1. Let a=10,b=20,c=0.
  2. Here c=a means c=10.
  3. Now a=0.
  4. Then a=b means a=20.
  5. Now b=0.
  6. Then b=c means b=10.
  7. So by this java interchanges the value.
  • Now print a & b.
  • Run the file and see what happens.

Wednesday, 28 October 2015

Division java programming

Division java programming


  • Open netbeans and open new frame.
  • Put the components from pallet to jFrame as given below


    • Open source code window by double clicking on button.
    • Write the code as given below


    • Open source code window by double clicking on button.
    • Write the code as given below
    • Handling with numbers we us either short as short or long as long or integer as it.
    • We have use int.
    • Integer.parseInt is a code us for coding a number.
    • a and b at variables use to type number while c is used to store the the value of a and b and also to show result.
    • / sign is use between a and b for the division.
    • After completing it ,run the program and see what happens