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.