Find the remaining balance after the transaction | Java program to find the remaining balance ; Function to find the balance ; Check if the transaction can be successful or not ; Transaction is successful ; Transaction is unsuccessful ; Driver Code
import java . util . * ; class GFG { static void findBalance ( int x , float bal ) { if ( x % 10 == 0 && ( ( float ) x + 1.50 ) <= bal ) { System . out . printf ( "%.2fNEW_LINE", bal - x - 1.50); } else { System . out . printf ( "%.2fNEW_LINE", bal); } } public static void main ( String [ ] args ) { int x = 50 ; float bal = ( float ) 100.50 ; findBalance ( x , bal ) ; } }