Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One use of static data members is to hold reference material thateach instance o

ID: 3616702 • Letter: O

Question

One use of static data members is to hold reference material thateach instance of the class might need. For example, suppose you areworking on a check writing program. You need a way to convertnumbers to their written equivalent (ie 54 is fifty four). If youcreated a class that represents a Number, that class would need thewritten equivalents of all of the numbers 0 through 19 and thewritten equivalents of 20 (twenty), 30 (thirty), 40 (forty), etc.It would not make sense to store all of those strings in eachinstance of Number because the strings never change. A static arrayof strings is the perfect solution to this type of problem.

Create a class named Number so that each instance of Number canhold a value, an integer in the range 0-99. The instance should beable to return a string that represents its value in words.

Explanation / Answer

It would be helpful if you post the particular problem as some ofus don't have the book. Thanks.