Difference between revisions of "2020 - Brexit will half the probabilities of households eating out"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "=Adding new function into Household class= In the household class find the following: <syntaxhighlight lang=csharp> public double GetChanceEatOut() {...")
 
(Adding new function into Household class)
Line 9: Line 9:
  
 
This returns the chance of eating out per day, we are going to create a method to change the value instead. So below this enter:
 
This returns the chance of eating out per day, we are going to create a method to change the value instead. So below this enter:
 +
 +
<syntaxhighlight lang=csharp>
 +
        public void ChangeChanceEatOut(double change)
 +
        {
 +
            chanceEatOutPerDay *= change;
 +
        }
 +
</syntaxhighlight>

Revision as of 17:15, 14 December 2019

Adding new function into Household class

In the household class find the following:

        public double GetChanceEatOut()
        {
            return chanceEatOutPerDay;
        }

This returns the chance of eating out per day, we are going to create a method to change the value instead. So below this enter:

        public void ChangeChanceEatOut(double change)
        {
            chanceEatOutPerDay *= change;
        }