Question
I can't figure out this method. Don't change the method type. Decoding UTF8. import java.util.Scanner; public class Battleship { /** * This method converts a
I can't figure out this method. Don't change the method type. Decoding UTF8.
import java.util.Scanner;
public class Battleship {
/** * This method converts a String representing a base (or radix) 26 number into a decimal (or * base 10) number. The String representation of the base 26 number uses the letters of the * Latin alphabet to represent the 26 digits. That is, A represents 0, B represents 1, C * represents 2, ..., Y represents 24, and Z represents 25. * * A couple of examples: * BAAA = 1 * 26^3 + 0 * 26^2 + 0 * 26^1 + 0 * 26^0 = 17576 * ZERTY = 25 * 26^4 + 4 * 26^3 + 17 * 26^2 + 19 * 26^1 + 24 * 26^0 = 11506714 * "&\"" = -14747 * For this method: * - use Math.pow to calculate the powers of 26. * - don't assume that the input is in any particular case; use toUpperCase(). * - don't check that the input is only 'A' to 'Z'. * - calculate the value of each digit relative to 'A'. * - start from either the first or last character, and calculate the exponent based on the * index of each character. * * @param coord The coordinate value in base 26 as described above. * @return The numeric representation of the coordinate. */ public static int coordAlphaToNum(String coord) { //FIXME return -1; }
public static void main(String[] args) { //FIXME } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started