I am trying to get my method to return to the main. I have tried return statements but when i run it all it gives me is nothing. It just follows what the main method has but the other methods do not get to return to the main method so what i have on the other methods do not show up in the output. Here is my code
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package project2;
import java.util.Scanner;
/**
*
* @author Jonathan
*/
public class Project2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
flipcoin();
}
public static int GetNum(String msg) {
Scanner keyboard= new Scanner(System.in);
int getNum = GetNum ("Enter the number of coins ");
getNum = keyboard.nextInt();
if (getNum < 0)
{
throw new IllegalArgumentException("Age cannot be negative.");
// setter logic
}
return getNum;
}
private static int flipcoin() {
int randomNum = (int)(Math.random()*2) +1;
return randomNum;
}
public static String getFlipType(int sideID)
{
if (sideID ==1)
{
return "heads";
}
else if (sideID ==2)
{
return "tails";
}
return null;
}
public static void printNumCoins(int headsOrTails, int numHeadsOrTails)
{
System.out.println(headsOrTails);
}
}