0

Create a NameBackwards application that prompts the user for his or her name and then displays the name backwards.

I need the code. I'm new to this! My code needs an array in it too!

5th Apr 2017, 11:04 PM
Akon
12 Respuestas
+ 14
Can you show us some sample input and output? Not fully understanding your question and code
6th Apr 2017, 12:08 AM
Jafca
Jafca - avatar
+ 14
String output = ""; for (int letter = wordLetters.length - 1; letter >= 0; letter++) { output += wordLetters[letter]; } //print output This should reverse a string... Not sure what your code does exactly
6th Apr 2017, 12:12 AM
Jafca
Jafca - avatar
+ 13
Can you show us what you've got already? And I'm assuming it's in Java?
5th Apr 2017, 11:05 PM
Jafca
Jafca - avatar
+ 12
So good to see you again @LEANDRO MACIEL...
11th Apr 2017, 1:02 PM
Jafca
Jafca - avatar
+ 7
usr = input() print(usr[::-1]) Done 😂
11th Apr 2017, 1:08 PM
MrCoder
MrCoder - avatar
+ 5
@MrCoder I like how you use Python already 😄
11th Apr 2017, 1:15 PM
Supersebi3
Supersebi3 - avatar
+ 2
pretty simple for js :D But...I will not post anythin' untill I'll see what you did or at least you're tryed somethin'.
5th Apr 2017, 11:10 PM
Rose Sevenyears
Rose  Sevenyears - avatar
+ 2
So, did I do this right @rose: import java.util.Scanner; public class NameBackwards { public static void main(String[] args) { final int LOW = 'A'; //smallest possible value final int HIGH = 'Z'; //highest possible value int[] letterCounts = new int[HIGH - LOW + 1]; Scanner input = new Scanner(System.in); String word; char[] wordLetters; int offset; //array index /* prompt user for a word */ System.out.print("Enter a word: "); word = input.nextLine(); /* convert word to char array and count letter occurrences */ word = word.toUpperCase(); wordLetters = word.toCharArray(); for (int letter = 0; letter < wordLetters.length; letter++) { offset = wordLetters[letter] - LOW; letterCounts[offset] += 1; } for (int i = LOW; i <= HIGH; i++) { System.out.println((char)i + ": " + letterCounts[i - LOW]); } } }
6th Apr 2017, 12:09 AM
Akon
+ 2
import java.io.*; import java.util.*; public class reverseString { public static void main(String[] args) { String input=""; System.out.println("Enter the input string"); try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); input = br.readLine(); char[] try1= input.toCharArray(); for (int i=try1.length-1;i>=0;i--) System.out.print(try1[i]); } catch (IOException e) { e.printStackTrace(); } }}
8th Apr 2017, 2:11 PM
Girish Kakade
Girish Kakade - avatar
0
Someone to help me with a C # language solution
11th Apr 2017, 1:01 PM
LEANDRO MACIEL
LEANDRO MACIEL - avatar
0
And ok can you help me with a C # language solutions please
11th Apr 2017, 1:03 PM
LEANDRO MACIEL
LEANDRO MACIEL - avatar
0
Jafca can you help me please
11th Apr 2017, 1:08 PM
LEANDRO MACIEL
LEANDRO MACIEL - avatar