Play audio slide show -- Keyboard shortcut: 'x'  Back to slide -- Keyboard shortcut: 'u'              Play sound for this slide -- Keyboard shortcut: 'y'  minibank2.pas - Minibank programmet i sammenhæng.Lecture 1 - slide 4 : 31
Program 1

Program Minibank;

  Type Kontotype = (checkKonto, aktionærKonto, pensionsKonto, gevinstKonto);
                   
                   checkKonto =
                     record
                       id: KontoId;
                       balance: Kroner;
                       renteSats: Real;
                       antalUdnyttedeChecks: Integer;
                     end;
 
                   Bankkonto typedefinitioner;

  procedure transaktion(kt: Kontotype);
  Type TransaktionsType = (opret, hæve, indsætte, tilskrivRente, clearCheck, nedlaeg);

    procedure checkkontoTransaktion;
    var ck: checkKonto;
    
        procedure opretCheckKonto(ck: checkKonto); begin ... end;
        procedure hæveCheckKonto(ck: checkKonto); begin ... end;
        procedure indsætteCheckKonto(ck: checkKonto); begin ... end;
        procedure tilskrivRenteCheckKonto(ck: checkKonto); begin ... end;
        procedure clearEnCheck(ck: checkKonto); begin ... end;
        procedure nedlaegCheckKonto(ck: checkKonto); begin ... end;
    
        function LaesTransaktionsType: TransaktionsType; begin ... end;
    
        procedure hentCheckKonto(var k: CheckKonto); begin ... end;
    
        procedure GemCheckKonto(var k: CheckKonto); begin ... end;
    
    begin
      hentCheckKonto(ck);
      tt := LaesTransaktionsType;
      case tt of
        opret:  opretCheckKonto(ck);
        hæve:  hæveCheckKonto(ck);
        indsætte: indsætteCheckKonto(ck);
        tilskrivRente: tilskrivRenteCheckKonto(ck);
        clearCheck: clearEnCheck(ck);
        nedlaeg:  nedlaegCheckKonto(ck);
      end;
      gemCheckKonto(ck);
    end (* checkkontoTransaktion *)
  
    Procedurer for andre typer af transaktioner;
  
  begin
    case kt of
      checkKonto:  checkKontoTransaktion;
      aktionærKonto:  aktionærKontoTransaktion;
      pensionsKonto:  pensionsKontoTransakton;
      gevinstKonto:  gevinstKontoTransaktion;
    end;
  end (* transaktion *)
  

  Function LaesKontotype: KontoType; begin ... end;

begin
  while not fyraften
  do begin
       kt := LaesKontoType;
       transaktion(kt);
     end
end.