Created
February 12, 2018 19:26
-
-
Save viveknarang/563601825d8a76be9db811d6a1934b38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void printTicket(int destinationNumber) // method signature, method name, public - accessibility | |
// of the method from external classes | |
{ | |
if (destinationNumber == 1) { | |
if (balance < price1) { | |
System.out.println("Please insert " + (price1 - balance) + " more dollars."); | |
} else { | |
System.out.println("************************"); | |
System.out.println("********MARTA********"); | |
System.out.println("******RED LINE******"); | |
System.out.println("****Cost :" + price1 + "dollars ****"); | |
System.out.println("****Destination : " + destination1 + "****"); | |
System.out.println("*************************"); | |
balance = balance - price1; | |
moneyCollections = moneyCollections + price1; | |
} | |
} else { | |
if (balance < price2) { | |
System.out.println("Please insert " + (price2 - balance) + " more dollars."); | |
} else { | |
System.out.println("************************"); | |
System.out.println("********MARTA********"); | |
System.out.println("******RED LINE******"); | |
System.out.println("****Cost : " + price2 + " dollars ****"); | |
System.out.println("****Destination : " + destination2 + " ****"); | |
System.out.println("*************************"); | |
balance = balance - price2; | |
moneyCollections = moneyCollections + price2; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment