Percentage change in Hemisphere volume if radius is changed | Java program to find percentage change in hemisphere volume wrt change in radius ; Function to find the change in hemispheric volume ; Driver code ; Get the change in radius ; Calculate the change in hemispheric volume
class GFG { static void new_vol ( double x ) { if ( x > 0 ) { System . out . print ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . pow ( x , 2 ) ) / 100 ) + " % " + " increaseNEW_LINE"); } else if ( x < 0 ) { System . out . print ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . pow ( x , 2 ) ) / 100 ) + "% decreaseNEW_LINE"); } else { System . out . print ( " Volume ▁ remains ▁ the ▁ same . " ) ; } } public static void main ( String [ ] args ) { double x = - 10.0 ; new_vol ( x ) ; } }