Articles & News Stories

Constructor

Description
Description:
Published
of 2
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
    Carl Joseph L. Mongolian BT302 ELECTIVE package volumeofsolids;import java.ul.Scanner;public class VolumeOfSolids {double total;stac int a; VolumeOfSolids( double rad , double hei){ total = ((22 * rad * rad * hei)/7); } VolumeOfSolids( double len , double hei,double wid){ total = (len * wid * hei); } VolumeOfSolids( double rad){ total = (4*22 * rad * rad *rad)/(3*7); } public stac void main(String[] args) { Scanner sc = new Scanner(System.in); do{ System.out.println( ); System.out.println( Volume Of Solids ); System.out.println( 1] Cylinder ); System.out.println( 2] Rectangular ); System.out.println( 3] Sphere ); System.out.println( 4] Exit ); System.out.print( Please enter you choice: ); a = sc.nextInt(); if (a == 1){ System.out.println( Cylinder ); System.out.print( Enter radius: ); double r = sc.nextDouble(); System.out.print( Enter height: ); double h = sc.nextDouble();   VolumeOfSolids v1 = new VolumeOfSolids(r,h); System.out.print( Volume: + v1.total); }else if (a == 2 ){ System.out.println( Rectangular ); System.out.print( Enter length: ); double l = sc.nextDouble(); System.out.print( Enter width: ); double w = sc.nextDouble(); System.out.print( Enter height: ); double h = sc.nextDouble(); VolumeOfSolids v2 = new VolumeOfSolids(l,w,h); System.out.println( Volume: + v2.total); }else if ( a == 3){ System.out.println( Spehere ); System.out.print( Enter Radius: ); double r = sc.nextDouble(); VolumeOfSolids v3 = new VolumeOfSolids(r); System.out.print( Volume: +v3.total); }else { System.exit(0); }}while(a!=4); }}
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x