public class Callers { public static void main( String args[] ) { PrepaidSimCard globe; PrepaidSimCard jasper; PrepaidSimCard smart; globe = new PrepaidSimCard(); // defaults to a balance of 100 pesos jasper = new PrepaidSimCard( 300 ); smart = new PrepaidSimCard( 200 ); System.out.println( "Globe balance: " + globe.getBalance() ); System.out.println( "Jasper balance: " + jasper.getBalance() ); System.out.println( "Smart balance: " + smart.getBalance() ); System.out.println( "---" ); globe.sendText(); // 1 peso per text sent globe.makeCall( 8 ); // 8 pesos per minute jasper.makeCall( 30 ); for ( int i = 0; i < 35; i++ ) { jasper.sendText(); smart.sendText(); } System.out.println( "Globe balance: " + globe.getBalance() ); System.out.println( "Jasper balance: " + jasper.getBalance() ); System.out.println( "Smart balance: " + smart.getBalance() ); System.out.println( "---" ); jasper.makeCall( 20 ); // not enough money for this call, balance // should be less than 8 pesos afterwards smart.makeCall( 20 ); smart.makeCall( 1 ); // call not allowed - 5 pesos left smart.sendText(); // but text allowed System.out.println( "Globe balance: " + globe.getBalance() ); System.out.println( "Jasper balance: " + jasper.getBalance() ); System.out.println( "Smart balance: " + smart.getBalance() ); System.out.println( "---" ); } }