Question: Write a method called allDecreasing that accepts an integer as its parameter and returns true if the digits in the number appear in descending order.

Write a method called allDecreasing that accepts an integer as its parameter and returns true if the digits in the number appear in descending order. For example, the calls of all Decreasing(8541) and all Decreasing(85530) should return true, but the call of allDecreasing(12345), allDecreasing(47225) should return false. The method should handle negative numbers as well. E.g. all Decreasingl-321) should return true while al Decreasingl-589) should return false. If input is a single digit number, the method should return true. So allDecreasing(-2) should return true. Write a method called showRightRotations This question involves printing the rotated versions of a String, Given a nonempty Strings, a right shift of s is formed by removing the last character of sand moving it to the front of s. A right rotation ofs is a String that can be formed by performing 0 or more right shifts of s. For example, ifs is the String "cat" then a right shift produces *tca", doing one more right shift produces "atc" and a third right shift produces "cat" itself. Write the method showRightRotations which take a String s as a parameter and prints all the rotations of s, starting with the right shift of s and ending when the first letter ends up back in the first spot. The method should print all rotations even if the rotations repeat. The following shows several examples of calls to showRight Rotations and the expected printed output. Method call Output showRightRotations ("cat") tca late cat showRightRotations (*) a showRightRotations ('perfect") tperfec ctperfe ectperf fectper rfectpe erfectp perfect
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
