program will classify a string as one of the following: a palindrome, a repeated word, or “nothing special”.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
using Java.
Part B – String Classifier (30%)
This program will classify a string as one of the following: a palindrome, a repeated word, or “nothing special”. A word is considered repeated if it repeats only once in a string (e.g., “pizzapizza”). Some palindrome examples are: “racecar”, “aa”, and “aaa”. To determine if it is a palindrome, recommend you make use of the below method. Please make sure this program works for all cases and conditions.
/**
* This method will return a reversed version of the input string
*/
static String reverseString(String inStr)
{
String outStr = "";
if (inStr != null)
{
int startIndex = inStr.length()-1;
for (int i=startIndex; i >= 0; i--)
{
outStr = outStr + inStr.charAt(i);
}
}
return outStr;
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images