Question: no random classes added / arrays either. Write a method expand that takes 2 integers as parameters: a positive number, and the number of digits
no random classes added / arrays either.
Write a method expand that takes 2 integers as parameters: a positive number, and the number of digits of that number. Your method should return the expanded form of the integer as a string. For example, for number 237 the method should return a string: 2100+310+7. For the number 4665 , the method should return the string: 41000+6100+610+5. For any negative number the method should return "Invalid". Note that you should add a space before and after the "+" sign. Assume that the number of digits is the exact count of digits of the number. Examples
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
