Fandom

Scratchpad

Share-withs2

215,688pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Output:

       Day of week:  MTWRFSS
               res1  xxxxxxx   los 7
               res2  x         los 1
               res3  xxx       los 3
               res4   xx       los 2
               res5     x      los 1
               res6      xx    los 2
Actual occupancy:    2221110

res1 rcnt: 0.4375
res2 rcnt: 0.0625
res3 rcnt: 0.1875
res4 rcnt: 0.125
res5 rcnt: 0.0625
res6 rcnt: 0.125

Source code:

use strict;
my @los = ( 7,1,3,2,1,2 );

my $total_room_nights;
foreach (@los) {
   $total_room_nights += $_;
}

my $rcnt_total;
my $res_num = 1;
foreach (@los) {
   my $rcnt = $_ / $total_room_nights;
   $rcnt_total += $rcnt;
   print "res$res_num rcnt: $rcnt\n";
   $res_num++;
}
print "\n\nTotal rcnt: $rcnt_total\n";

Also on Fandom

Random wikia