### Assignments Help

**7.34 (Sort characters in a string) Write a method that returns a sorted string using the following header: public static String sort(String s) For example, sort("acb") returns abc. Write a test program that prompts the user to enter a string and displays the sorted string.

*7.33 (Culture: Chinese Zodiac) Simplify Listing 3.9 using an array of strings to store the animal names.

**7.32 (Partition of a list) Write the following method that partitions the list using the first element, called a pivot. public static int partition(int[] list) After the partition, the elements in the list are rearranged so that all the elements before the pivot are less than or equal to the pivot and the elements after…

**7.31 (Merge two sorted lists) Write the following method that merges two sorted lists into a new sorted list. public static int[] merge(int[] list1, int[] list2) Implement the method in a way that takes at most list1.length + list2. length comparisons. Write a test program that prompts the user to enter two sorted lists and…

*7.30 (Pattern recognition: consecutive four equal numbers) Write the following method that tests whether the array has four consecutive numbers with the same value. public static boolean isConsecutiveFour(int[] values) Write a test program that prompts the user to enter a series of integers and displays if the series contains four consecutive numbers with the same…

*7.29 (Game: pick four cards) Write a program that picks four cards from a deck of 52 cards and computes their sum. An Ace, King, Queen, and Jack represent 1, 13, 12, and 11, respectively. Your program should display the number of picks that yields the sum of 24.

*7.28 (Math: combinations) Write a program that prompts the user to enter 10 integers and displays all combinations of picking two numbers from the 10.

7.27 (Identical arrays) The arrays list1 and list2 are identical if they have the same contents. Write a method that returns true if list1 and list2 are identical, using the following header: public static boolean equals(int[] list1, int[] list2) Write a test program that prompts the user to enter two lists of integers and displays…

7.26 (Strictly identical arrays) The arrays list1 and list2 are strictly identical if their corresponding elements are equal. Write a method that returns true if list1 and list2 are strictly identical, using the following header: public static boolean equals(int[] list1, int[] list2) Write a test program that prompts the user to enter two lists of…

7.25 (Algebra: solve quadratic equations) Write a method for solving a quadratic equation using the following header: public static int solveQuadratic(double[] eqn, double[] roots) The coefficients of a quadratic equation ax2 + bx + c = 0 are passed to the array eqn and the real roots are stored in roots. The method returns the…

**7.24 (Simulation: coupon collectorâ€™s problem) Coupon collector is a classic statistics problem with many practical applications. The problem is to pick objects from a set of objects repeatedly and find out how many picks are needed for all the objects to be picked at least once. A variation of the problem is to pick cards…

***7.22 (Game: Eight Queens) The classic Eight Queens puzzle is to place eight queens on a chessboard such that no two queens can attack each other (i.e., no two queens are on the same row, same column, or same diagonal). There are many possible solutions. Write a program that displays one such solution. A sample…