Question: Create a class called Counter. Your class should have two properties. 1. A public integer property initial_count with value 0 2. A private integer property

 Create a class called Counter. Your class should have two properties.

Create a class called Counter. Your class should have two properties. 1. A public integer property "initial_count" with value 0 2. A private integer property "count" with no value; Set initial_count directly from main() function. Set it to 10. Your class should have the following methods: 1. setCounter() : this method will set count the same as initial_count 2. increment() : this method will increase the value of count by 1. 3. decrement() : this method will decrease the value of count by 1. 4. displayCount() : this method will print the current value of count to the console

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!