Program to check if tank will overflow , underflow or filled in given time | Java program to check if Tank will overflow or not in given time ; function to calculate the volume of tank ; function to print overflow / filled / underflow accordingly ; driver code ; radius of the tank ; height of the tank ; rate of flow of water ; time given ; calculate the required time ; printing the result
class Number { public static float volume ( int radius , int height ) { return ( ( 22 / 7 ) * radius * radius * height ) ; } public static void check_and_print ( double required_time , double given_time ) { if ( required_time < given_time ) System . out . print ( " Overflow " ) ; else if ( required_time > given_time ) System . out . print ( " Underflow " ) ; else System . out . print ( " Filled " ) ; } public static void main ( String [ ] args ) { int radius = 5 , height = 10 , rate_of_flow = 10 ; double given_time = 70.0 ; double required_time = volume ( radius , height ) / rate_of_flow ; check_and_print ( required_time , given_time ) ; } }