Complete the code to define a method that changes the value of the field.
class Counter { private int count = 0; public void [1]() { count++; } }
The method name Increment clearly shows it increases the count field by one.
Complete the method to reset the count field to zero.
class Counter { private int count = 0; public void Reset() { count [1] 0; } }
The assignment operator = sets the count field to zero.
Fix the error in the method that returns the current count.
class Counter { private int count = 0; public int GetCount() { return [1]; } }
The field name is count with lowercase 'c'. It must be returned exactly as declared.
Fill both blanks to create a method that adds a given number to the count.
class Counter { private int count = 0; public void Add([1] number) { count [2] number; } }
The method parameter must be an int to match the count type, and += adds the number to count.
Fill all three blanks to create a method that multiplies count by a factor and returns the result.
class Counter { private int count = 1; public int MultiplyBy([1] factor) { count [2] factor; return [3]; } }
The parameter type is int, *= multiplies and assigns, and the method returns the updated count.