Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Here is a module and class example for a few programming languages.
3. Problem statement
The module part should define a class Adder. Use your initials for the prefix of the module name. The module name suffix should be Adder. The constructor should set the integer class sum to zero. The class should contain a method sumAdd which takes one integer and adds that value to the sum. The class should contain a method sumGet which should return the current sum.
The main code should access the module, create an instance of the Adder class and then call that instance to add the integer values from 0 to 8 (inclusive) using the sumAdd method of the Adder class. The main code should then use the sumGet method to get and display the sum using a print statement.
4. Links
In addition to class notes, see the following in particular.