Question: Description printNumbers3 Write a recursive method printNumbers3 that takes integers a, b, c, and d prints all combinations that contain b number of a's

Description printNumbers3 Write a recursive method printNumbers3 that takes integers a, b, c, and d prints all combinations that contain b number of a's and d number of c's on separate lines. For instance, if you called printNumbers3(1, 2, 3, 4) it would print every combination of 2 1's and 4 3's: 113333 131333 133133 133313 133331 311333 313133 313313 313331 331133 331313 331331 333113 333131 333311 If any of the integers are negative, throw an IllegalArgumentException. + PrintNumbers.java 1 public class PrintNumbers { 234 public static void printNumbers3 (int a, int b, int c, int d) { } if (a < 0 || b < 0 || c < 0 || d < 0) { throw new IllegalArgumentException(); // TODO: Your code here 5 6 7 } 8 9 10 11 } 12 private static void print() { if () 13 14 15 16 17 } public static void main(String[] args) { printNumbers3(1, 2, 3, 4); } All /home/PrintNumbers.java 9:31 Spaces: 4 (Auto)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
