Tuesday, March 7, 2017

Electrical Resistance of Wire

Tags

The electrical resistance R of a cylindrical wire with length l (in meter) and diameter d (in meter) can be computed from the area A of its diameter (m2) and the  resistivity Ρ of the material (rho, meter times Ohm). The formula:

R=P*(l/A)

Code::

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author mrdishant
 */
import java.util.*;
public class Resistance {
    public static void main(String[] nt)
    {
        Scanner in=new Scanner(System.in);
        System.out.print("Enter Length of wire:");
        double length=in.nextDouble();
        System.out.print("Enter Diameter of Wire:");
        double d=in.nextDouble();
        System.out.print("Enter Resistivity of wire:");
        double p=in.nextDouble();
        double r=p*(4*length/3.142*d*d);
        System.out.println("Resistance of Wire:"+r);
 
    }
    
}

Output::