/** * This class demonstrates how to write and call methods. * * @author alchambers * @version spring2019 */ public class MethodExamples{ // This method takes no inputs and returns no value private static void printWelcome(){ System.out.println("===================================="); System.out.println("Welcome to the game of Tic Tac Toe"); System.out.println("Two players (x and o) are competing to be the first"); System.out.println("to fill a row, column, or diagonal with their mark"); System.out.println("===================================="); System.out.println(); } // This method takes inputs but returns no value private static void displayInformation(String name, int age){ System.out.println("User Profile:"); System.out.println("Name: " + name); System.out.println("Age: " + age); } // This method takes 2 input values and returns a double private static double computeTip(double mealAmount, double tipPercent){ double tip = mealAmount * tipPercent; return tip; } // The main() method is the first method we looked at public static void main(String[] args){ double tip = computeTip(24.50, 0.20); System.out.println("If your meal costs $24.50 and you are tipping 20%," + " then the tip amount is $" + tip); displayInformation("Felipita Vigil", 54); printWelcome(); } }