3:50 pm - Friday February 19, 0213

find body diagonal of cuboid

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

/**
@Author:CandidJava
@Description: find Diagonal of the cuboid using Diacu Class
*/
import java.lang.Math;

class Diacu {
int breath, height, length;
double Dia;

Diacu(int b, int h, int l)// creating constructor
{
breath = b;
height = h;
length = l;

}

void bodyDiagonalOfCuboid()// creating method for calculate Diagonal of the
// cuboid
{
Dia = Math.sqrt(breath ^ 2 + height ^ 2 + length ^ 2);// calculate
// Diagonal
// using Math
System.out.println(Dia);// print Diagonal
}

public static void main(String args[]) {
Diacu s1 = new Diacu(55, 6, 7);// Create the object for Diacu
s1.bodyDiagonalOfCuboid();// CALL THE METHOD
}
}

OUTPUT:
7.21110255….

Filed in: Z-A All Java Codes

Comments are closed.