Skip to content

Instantly share code, notes, and snippets.

@DonatasD
Created November 6, 2018 15:15
Show Gist options
  • Save DonatasD/a118e1338e08822a858cb2cb7829b67a to your computer and use it in GitHub Desktop.
Save DonatasD/a118e1338e08822a858cb2cb7829b67a to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Example {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.println("Enter a month: ");
int month = reader.nextInt();
System.out.println("Enter a day: ");
int day = reader.nextInt();
reader.close();
System.out.println(findHoroscope(month, day));
}
private static String findHoroscope(int month, int day) {
if (month == 2 && day >= 20 && day <= 31 || month == 3 && day >= 1 && day <=20) {
return "Pisces";
}
return "Not available";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment