Reputationsaktivität
-
user2001 hat auf BeppeCSharpNauter in AP2 FIAE Algorithmenstatic public int RechnelastTage(DateTime anfang , DateTime ende , Belegung[] belegen , Station station) { DateTime t_date = anfang; int arrayLength = 0; while (t_date < ende) { arrayLength++; t_date = t_date.AddDays(1); } int[] tage = new int[arrayLength]; t_date = anfang; int j = 0; while (t_date < ende) // ich kann eigentlich direkt auf tage iterieren , aber bei der prüfung ist mir nicht eingefallen { for( int i = 0; i < belegen.Length; i++) { if (belegen[i].GetStart() >= anfang && belegen[i].GetEnd() <= ende && belegen[i].IdStation() == station.ID()) { tage[j]++; } } j++; t_date = t_date.AddDays(1); } int lastTage = 0; foreach ( int i in tage) { double last = (double)i / (double)station.AnzahlBett(); if ( last > 0.8) { lastTage++; } } return lastTage; }
-
user2001 hat eine Reaktion von BeppeCSharpNauter in AP2 FIAE AlgorithmenMeine Definition der Funktion
static public int RechnelastTage(DateTime anfang , DateTime ende , Belegung[] belegenungen, Station station) currentDate := anfang; countAusgelasteteTage := 0; While currentDate <= end countBelegteBetten := 0; for i := 0 to belegungen.length -1 if belegungen[i].getStationId() = station.getStationId() if belegungen[i].getDatumVon() <= currentDate and belegungen[i].getDatumBis() >= currentDate countBelegteBetten := countBelegteBetten + 1; end if end if end for if countBelegteBetten / station.getAnzahlBetten() > 0.8 countAusgelasteteTage := countAusgelasteteTage + 1; end if end while return countAusgelasteteTage; end RechnelastTage