Skip to content

Instantly share code, notes, and snippets.

@malte-j
Created October 16, 2019 20:25
Show Gist options
  • Save malte-j/10ae5030c90996b6995d1019b251d7d0 to your computer and use it in GitHub Desktop.
Save malte-j/10ae5030c90996b6995d1019b251d7d0 to your computer and use it in GitHub Desktop.
public void berechneRestZeitVonSchicht(int std, int min) {
int schicht = std / 8 + 1;
int volleMinuten = std * 60 + min;
int minutenEnde = schicht * 8 * 60;
int minutenBisEnde = minutenEnde - volleMinuten;
int stundenBisEnde = minutenBisEnde / 60;
int minutenFormattiert = minutenBisEnde % 60 - 1;
System.out.printf("Anfrage um: %d:%d%n", std, min);
System.out.printf("Aktuelle Schicht: %d%n", schicht);
System.out.printf("Restliche Zeit in der Schicht: %d Stunden, %d Minuten%n", stundenBisEnde, minutenFormattiert);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment