find the volume of the box

find the volume of the box

View Answers

June 12, 2009 at 4:06 PM

Hi Friend,

Try the following code:

class CubeBox
{
public double width;
public double depth;
public double height;
public CubeBox(double width,double depth,double height)
{
this.width=width;
this.depth=depth;
this.height=height;
}
public double calculate()
{
double volume = width*depth*height;
return volume;
}
public static void main(String[] args)
{
CubeBox box = new CubeBox(5,4,3);
double volumeOfBox = box.calculate();
System.out.println("The volume is " + volumeOfBox);
}
}
Thanks
RoseIndia Team









Related Tutorials/Questions & Answers:
find the volume of the box - Java Interview Questions
find the volume of the box  Write a class Box with the variable width... and a method to find the volume of the box and also write the main program, which creates the box object, and find the volume of the box. Print the result
calculate volume of cube, cylinder and rectangular box using method overloading in java
calculate volume of cube, cylinder and rectangular box using method overloading in java  calculate volume of cube, cylinder and rectangular box using method overloading in java   calculate volume of cube, cylinder
Advertisements
write a program to calculate volume of a cube, cylinder, rectangular box using method overloading
write a program to calculate volume of a cube  write a program to calculate volume of a cube, cylinder, rectangular box using method overloading..., 8, 9); System.out.println("Volume of rectangular box
ModuleNotFoundError: No module named 'cloud-volume'
ModuleNotFoundError: No module named 'cloud-volume'  Hi, My Python... 'cloud-volume' How to remove the ModuleNotFoundError: No module named 'cloud-volume' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'docker-volume'
ModuleNotFoundError: No module named 'docker-volume'  Hi, My... 'docker-volume' How to remove the ModuleNotFoundError: No module named 'docker-volume' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mac-volume'
ModuleNotFoundError: No module named 'mac-volume'  Hi, My Python... 'mac-volume' How to remove the ModuleNotFoundError: No module named 'mac-volume' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'cloudmesh-volume'
ModuleNotFoundError: No module named 'cloudmesh-volume'  Hi, My... named 'cloudmesh-volume' How to remove the ModuleNotFoundError: No module named 'cloudmesh-volume' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cloud-volume'
ModuleNotFoundError: No module named 'cloud-volume'  Hi, My Python... 'cloud-volume' How to remove the ModuleNotFoundError: No module named 'cloud-volume' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'docker-volume'
ModuleNotFoundError: No module named 'docker-volume'  Hi, My... 'docker-volume' How to remove the ModuleNotFoundError: No module named 'docker-volume' error? Thanks   Hi, In your python
Version of biz.hochguertel>ingredients-volume dependency
List of Version of biz.hochguertel>ingredients-volume dependency
ModuleNotFoundError: No module named 'docker-volume-manager'
ModuleNotFoundError: No module named 'docker-volume-manager'  Hi...: No module named 'docker-volume-manager' How to remove the ModuleNotFoundError: No module named 'docker-volume-manager' error? Thanks   Hi
ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined'
ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined' ...: ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined' How to remove the ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined
ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined'
ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined' ...: ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined' How to remove the ModuleNotFoundError: No module named 'm9s-carrier-weight-volume-combined
ModuleNotFoundError: No module named 'volume-manifest-tool'
ModuleNotFoundError: No module named 'volume-manifest-tool'  Hi...: No module named 'volume-manifest-tool' How to remove the ModuleNotFoundError: No module named 'volume-manifest-tool' error? Thanks   Hi
ModuleNotFoundError: No module named 'docker-bash-volume-watcher'
ModuleNotFoundError: No module named 'docker-bash-volume-watcher'  Hi...: No module named 'docker-bash-volume-watcher' How to remove the ModuleNotFoundError: No module named 'docker-bash-volume-watcher' error? Thanks
ModuleNotFoundError: No module named 'docker-volume-manager'
ModuleNotFoundError: No module named 'docker-volume-manager'  Hi...: No module named 'docker-volume-manager' How to remove the ModuleNotFoundError: No module named 'docker-volume-manager' error? Thanks   Hi
ModuleNotFoundError: No module named 'docker-windows-volume-watcher'
ModuleNotFoundError: No module named 'docker-windows-volume-watcher'  ...: No module named 'docker-windows-volume-watcher' How to remove the ModuleNotFoundError: No module named 'docker-windows-volume-watcher' error
ModuleNotFoundError: No module named 'freesurfer-volume-reader'
ModuleNotFoundError: No module named 'freesurfer-volume-reader'  Hi...: No module named 'freesurfer-volume-reader' How to remove the ModuleNotFoundError: No module named 'freesurfer-volume-reader' error? Thanks  
Maven Dependency ingredients-volume >> 0.1.1
You should include the dependency code given in this page to add Maven Dependency of biz.hochguertel >> ingredients-volume version0.1.1 in your project
Maven Dependency ingredients-volume >> 0.2.0
You should include the dependency code given in this page to add Maven Dependency of biz.hochguertel >> ingredients-volume version0.2.0 in your project
Maven Repository/Dependency: biz.hochguertel | ingredients-volume
Maven Repository/Dependency of Group ID biz.hochguertel and Artifact ID ingredients-volume. Latest version of biz.hochguertel:ingredients-volume dependencies. # Version Release Date
Maven dependency for biz.hochguertel - ingredients-volume version 0.1.1 is released. Learn to use ingredients-volume version 0.1.1 in Maven based Java projects
of ingredients-volume released The developers of   biz.hochguertel - ingredients-volume project have released the latest version of this library on 24 Jun 2015, the released version of  biz.hochguertel - ingredients-volume library
Maven dependency for biz.hochguertel - ingredients-volume version 0.2.0 is released. Learn to use ingredients-volume version 0.2.0 in Maven based Java projects
of ingredients-volume released The developers of   biz.hochguertel - ingredients-volume project have released the latest version of this library on 26 Jun 2015, the released version of  biz.hochguertel - ingredients-volume library
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
ModuleNotFoundError: No module named 'box-box'
ModuleNotFoundError: No module named 'box-box'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'box-box' How to remove the ModuleNotFoundError: No module named 'box-box
HTML in the box
HTML in the box  Can I use any HTML in the box
input box
input box  give me the code of input box in core java
input box
input box  give me the code of input box in core java
Volume setting for webpage flash - Design concepts & design patterns
Volume setting for webpage flash   Hello: I'm glad I found your website. Thank you for the opportunity to ask questions. For months I'v been searching with no success for a way to enter a volume setting for the flash file
select box and text box validations
select box and text box validations  hi, any one please tell me how to set validations for select box and text boxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
find the factorial
find the factorial  how to find the factorial through the while loop?   class FindFactorial { public static void main(String[] args) { int value = 5, factorial = 1, temp = value; while
find and substring
find and substring   **import java.io.BufferedReader; import... BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter find...){ } } public void findreplace(String find, String replace
dropdown box
dropdown box  i need to have country,state and city in drop down box using ajax and use db2 database   Have a look at the following link: JSP dependent dropdown
Hollow Box
Hollow Box  Write an application program that will draw a hollow box (a box with empty space in between). The program will ask the user to key... to exit. For example, if the user keys in 8, the hollow box (of length and width
dialog box
dialog box to show latest question  hello. write an application that displays a series of at least four interview questions and each question should... of the interview, use a dialog box to ask whether the user wants to - enter another set
dialog box
dialog box to ask to quit or continue  hello. write an application that displays a series of at least four interview questions and each question... of the interview, use a dialog box to ask whether the user wants to - enter another set
How to design a music system volume button
How to design a music system volume button In this tutorial we are going to tell you how to design a music system volume button. Let's go with this example. We start here: Make a New File: Make a new file
How to resolve this error The filename, directory name, or volume label syntax is incorrect
How to resolve this error The filename, directory name, or volume label syntax is incorrect  Image is stored in physical directory like this String...\website\screenshots\amit1220120625_110414.PNG (The filename, directory name, or volume
combo box
combo box  Hi, [_|] dropdown box [ ] [INCLUDE... a screen like this using jsp-servlet(or DAO,DTO),in that drop down box i should get
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
dialog box  hello. write an application that displays a series of at least four interview questions and each question should have at least three possible numeric choice answers. at the end of the interview, use a dialog box
dialog box
of the interview, use a dialog box to ask whether the user wants to - enter another set
dialog box
. at the end of the interview, use a dialog box to ask whether the user wants
dialog box
. at the end of the interview, use a dialog box to ask whether the user wants
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
How to create an input box?
How to create an input box?  How to create an input box

Ads