Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

public static int stringValue(String word) It returns the value of a string which is the sum of the values of its characters. The value of

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

public static int stringValue(String word) It returns the value of a string which is the sum of the values of its characters. The value of each character is the ASCII code of the character (e.g. A has a value of 65 , B has a value of 66 , a has a value of 97 , etc.) with a few exceptions: - Double-letters (e.g. ee, mm, II, tt, etc.) are valued once, not twice. - The space character has a value of zero - The value of each number-character is multiplied by the largest value of the non-numbercharacters in the string. To simplify things a bit, assume that the word will not include, and your program will not be tested with, any characters that have an ASCII code lower than 40 or higher than 123. public static int mirrorNum(int num) The method accepts an integer and returns the mirrored integer. In case of a negative number, it retains the sign. You may not use any classes from any package, not even the Math and String classes, to implement the mir rorNum method Examples: public static boolean raisedNum(long num) There are some numbers whose value is the sum of xy+yx where x and y are integers greater than 1. Let's call these numbers raised numbers. Write a method that accepts a long and returns true if the number is raised, and false otherwise. Examples: public static int [] [] smallestSubarray(int [] [] array, int sum) It takes a rectangular array and returns a square-size subarray of it whose values have a sum that is equal or larger to sum. A subarray can't be smaller than 22. If there are more than one square-size subarrays that satisfy the requirements, the method must return the square that has the smallest size. If two or more equally-sized squares satisfy the requirements, it must return the square whose values have the highest sum. Assume that the sum has such a value that always warrants a solution (i.e. no need to check or worry about this)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions