Skip to content

Instantly share code, notes, and snippets.

@nitrodragon
Created August 11, 2017 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitrodragon/8f6a5fbc16582250f7ab06348a53cfdc to your computer and use it in GitHub Desktop.
Save nitrodragon/8f6a5fbc16582250f7ab06348a53cfdc to your computer and use it in GitHub Desktop.
Ever wondered exactly how many bottles of beer on the wall there really are?
import java.util.Scanner;
public class BeersOnTheWall {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the amount of hours in your trip:");
int hours = sc.nextInt();
System.out.println("Now the minutes:");
int minutes = sc.nextInt();
int beers = (((hours * 60) * 60) / 8) + ((minutes * 60) / 8);
sc.close();
System.out.println("On a trip that is " + hours + " hours and " + minutes + " minutes long, there are " + beers + " bottles of beer on the wall (with a margin of error of about 8), assuming your tempo is 120bpm.");
System.out.println("Start counting.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment