Write a class named Accumulator containing: An instance variable named sum of type integer, initialized to 0. A method named getSum that returns the value of sum. A method named add that accepts an integer parameter. The value of sum is increased by the value of the parameter.

Write a class named Accumulator containing: An instance variable named sum of type integer, initialized to 0. A method named getSum that returns the value of sum. A method named add that accepts an integer parameter. The value of sum is increased by the value of the parameter.

LANGUAGE: JAVA

CHALLENGE:

Write a class named Accumulator containing:
An instance variable named sum of type integer, initialized to 0.
A method named getSum that returns the value of sum.
A method named add that accepts an integer parameter. The value of sum is increased by the value of the parameter.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level