Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Business.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace IbanLagen
- {
- class Business
- {
- public bool controleIban(string invoer)
- {
- bool geldig;
- if (invoer.Length == 16)
- {
- string land = invoer.Substring(0, 2);
- long rekening = Convert.ToInt64(invoer.Substring(4, 10));
- int controle = Convert.ToInt32(invoer.Substring(14, 2));
- if (land != "BE")
- {
- geldig = false;
- }
- else
- {
- if ((rekening % 97) != controle)
- {
- geldig = false;
- }
- else
- {
- geldig = true;
- }
- }
- }
- else
- {
- geldig = false;
- }
- return geldig;
- string melding = "";
- if (!geldig)
- {
- melding = "g";
- Console.ForegroundColor = ConsoleColor.Red;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Green;
- }
- }
- }
- }
- //Program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace IbanLagen
- {
- class Program
- {
- static void Main(string[] args)
- {
- Business rekening = new Business();
- Console.WriteLine("Geef een volledig nummer zonder spaties");
- string invoer = Console.ReadLine();
- string melding = "";
- if (!rekening.controleIban(invoer))
- {
- melding = "g";
- Console.ForegroundColor = ConsoleColor.Red;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Green;
- }
- Console.WriteLine("Dit is {0}een geldig IBAN nummer", melding);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement