Advertisement
KeeJayBe

btwnummer prog1

Jan 16th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. /*
  2.  * KK    KK  JJJJJJJJJJ  BBBBBBBB
  3.  * KK  KK            JJ  BB      BB
  4.  * KKKK              JJ  BBBBBBBB
  5.  * KK  KK    JJ      JJ  BB      BB
  6.  * KK    KK    JJJJJJ    BBBBBBBBBB
  7.  *
  8.  * Copyright 2018 Jordy Van Kerkvoorde
  9.  */
  10. package domein;
  11.  
  12. import java.util.Scanner;
  13.  
  14. /**
  15.  *
  16.  * @author KeeJayBe
  17.  */
  18. public class BTWNummerApp {
  19.     public static void main(String[] args) {
  20.         Scanner s = new Scanner(System.in);
  21.         System.out.print("Geef een btw-nummer van de vorm ABC.PQR.XYZ zonder de puntjes: ");
  22.         int nummer = s.nextInt();
  23.         boolean geldig = isGeldig(nummer);
  24.         if(geldig){
  25.             System.out.printf("%n%d is een geldig btw-nummer.%n", nummer);
  26.         }else{
  27.             System.out.printf("%n%d is een ongeldig btw-nummer.%n", nummer);
  28.         }
  29.     }
  30.     private static boolean isGeldig(int nr){
  31.         int ax= nr/100;
  32.         int yz= nr%100;
  33.         return (ax%97)+yz==97;
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement