import java.util.*;
  public class sSone  {
  public static void main ( String[] args )  {
    Scanner scan = new Scanner ( System.in );
      System.out.print ( "Enter an integer number from 0-128" );
	int inInt = scan.nextInt

PURPOSE: program that receives an integer number from 0-128 and displays the equivalent letter. For example, if the integer number is 97 the resulting letter is letter a.

REQUIREMENTS: don't use if statements, switch statements

PROBLEM: i don't know how can i work this thing out

Recommended Answers

All 7 Replies

Well Its quite simple I believe, A char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar.

Therefore, if you want to find the ascii value of a number, you simple cast the number as a char. e.g.

System.out.print((char)+97);
//This will print a
//all you need to do is swap that number with an input from the user.

The 'program' to do this is basically 5 lines of code. No if or switch statements needed...Just an input from the user and a println.

also, to go in the opposite direction, you just cast the character as an int.

System.out.println((int)'A');//will print out 65

tnx for the help dude, i'll try to apply ur advices
can u send me the jdk1.6.0_20 FILE ONLY?
can't download in this computer rental shop i came at
the connection is slow
can u?

tnx for the help dude, i'll try to apply ur advices
can u send me the jdk1.6.0_20 FILE ONLY?
can't download in this computer rental shop i came at
the connection is slow
can u?

What platform is your PC (Windows/linux etc)?

And how on earth are you creating java programs without having JDK installed? That is not possible my friend!

well, i don't have a unit, i just rent at computer shops, i shud have downloaded JDK, but the connection here is slow, i only need the jdk1.6.0_20 file, where the javac is, unit here now is windows, my gmail <<snip>>, tnx 4 the help dude

Software Download
Product Not Found

The Download Center link you selected did not work properly and may contain an invalid part number.

Visit the Sun Download Center to see a full list of products that are currently available.

If you require further assistance, report the product name and referring URL to Customer Service.

Thank you.

that appeared, can u just send me via email? its only the jdk1.6.0_20 file

Yes, It is not possible to direct link, I have sent you an email with explicit instructions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.