2020 - The probability of eating out is lower on a monday, and high on a friday, saturday & sunday (eg days MOD 7)

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

Follow this link first to count the number of days

2020_-_Display_how_many_days_have_passed

Find the ProcessDayEnd method in Simulation class (not the one in Company class)

Look for simulationSettlement.FindOutIfHouseholdEatsOut(counter, ref x, ref y)

Add extra parameter ie simulationSettlement.FindOutIfHouseholdEatsOut(counter, ref x, ref y, days)

Go to the Settlement class and find FindOutIfHouseholdEatsOut

Add the extra parameter ie FindOutIfHouseholdEatsOut(int householdNo, ref int x, ref int y, int days)

Add a new double called change

Inside this method, create a switch statement on the days%7 ie switch(days%7){}

Add a case for 0 and set change to 0.8, case for 4,5,6 should set change to 1.2

Inside this method look for households[householdNo].GetChanceEatOut()

Add * change to this code, ie households[householdNo].GetChanceEatOut()*change