This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I hope someone can help me. I am doing a program that involves converting the letters in someone's name to numbers. Our teacher gave us a conversion grid, and I worked out a formula for converting the letters using modular arithmetic (see below). What I want to do is to go through the name, converting each letter to a number, according to the formula shown. I thought that a String array would be the best way to do this, but I keep getting errors. The source code is below:
(edited by Cindy to format code)
[This message has been edited by Cindy Glass (edited November 15, 2001).]
Jade, A few hints: - nameArray.length == 1, not 13 - the expression (('a' - 'a') % 9) + 1 results in an int value of 1. This is evaluated at compile time and will never change inside the for-loop. You cannot assign the value 1 to a String variable. Good luck! Junilu
You could convert the String to a char Array using the toCharArray() method of String, and THEN walk through the chars doing the conversion etc. String name = "Brian Candido"; //or better yet = args; char myNameArray = name.toCharArray();
"JavaRanch, where the deer and the Certified play" - David O'Meara