জাভা প্রোগ্রামিং পর্ব-১৭








Code:Filename-DistanceOfTwoPoint.java
import java.util.*;
import javax.swing.*;
public class DistanceOfTwoPoint {
    public static void main (String arg[]){
        Scanner input = new Scanner (System.in);
        double x1, x2, y1, y2, distance;

        System.out.print("Enter value for x1: = ");
        x1= input.nextDouble();
        System.out.print("Enter value for x2: = ");
        x2= input.nextDouble();
        System.out.print("Enter value for y1: = ");
        y1= input.nextDouble();
        System.out.print("Enter value for y2: = ");
        y2= input.nextDouble();

        distance = Math.sqrt((Math.pow((x2-x1), 2)+Math.pow((y2-y1), 2)));
        System.out.print("The distance is: = " + distance);
        }
    }







Code:Filename-AreaOfTriangle.java
import java.util.*;
import javax.swing.*;
public class AreaOfTriangle {
    public static void main (String arg[]){
        Scanner input =new Scanner (System.in);
        double side1, side2, side3, s, area;

        System.out.print("Enter value for side1: = ");
        side1= input.nextDouble();
        System.out.print("Enter value for side2: = ");
        side2= input.nextDouble();
        System.out.print("Enter value for side3: = ");
        side3= input.nextDouble();

        if((side1+side2)>side3 && (side2+side3)>side1 && (side1+side3)>side2)
        {
        s=(side1+side2+side3)/2;
        area =Math.pow((s*(s-side1)*(s-side2)*(s-side3)), 0.5);
        System.out.print("The are of traingle is: = "+ area);
        }
        else
            System.out.print("Thre area dos't calculate");
        }
    }







Code:Filename-AreaOfHexagon.java
import java.util.*;
import javax.swing.*;
public class AreaOfHexagon {
    public static void main (String arg[]){
        Scanner input =new Scanner (System.in);
        double side, area;

        System.out.print("Enter value for side: = ");
        side= input.nextDouble();

        area =((3*Math.sqrt(3))*Math.pow(side, 2))/2;
        System.out.print("The are of traingle is: = "+ area);
        }
    }

Loading
Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Flying Twitter Bird Widget By ICT Sparkle