<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank">Use Code Tags!!</a>
star chaser..
Ken Mullins wrote:I want to convert this to a capital letter equal to the value of the random number.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
pete stein wrote:
Ken Mullins wrote:I want to convert this to a capital letter equal to the value of the random number.
Hello. Can you clarify the statement above? For instance, what capital letter is equal to 2302?
Also, what have you tried so far? Can you post your code?
Best of luck!![]()
Oh, and welcome to the Ranch!
Ken Mullins wrote:
pete stein wrote:
Ken Mullins wrote:I want to convert this to a capital letter equal to the value of the random number.
Hello. Can you clarify the statement above? For instance, what capital letter is equal to 2302?
Also, what have you tried so far? Can you post your code?
Best of luck!![]()
Oh, and welcome to the Ranch!
I have converetd the number returned by using current time in milliSeconds and have generated 2 2 digit number. I would like to convert this number to a capital letter.
Ken Mullins wrote:
I have converetd the number returned by using current time in milliSeconds and have generated 2 2 digit number. I would like to convert this number to a capital letter.
The code generates a random 2 digit number. I want to convert this number using the Ascii or unicode to the corresponding letter. Am I going down the wrong road here ? I am new at this but I am enjoying it.pete stein wrote:
Ken Mullins wrote:
I have converetd the number returned by using current time in milliSeconds and have generated 2 2 digit number. I would like to convert this number to a capital letter.
You still will want to describe to us in one or several sentences just how you intend to convert a number to a letter. Your post is still not clear on this point.
Best of luck!
The goal here is simply to display the letter.pete stein wrote:
Ken Mullins wrote:
I have converetd the number returned by using current time in milliSeconds and have generated 2 2 digit number. I would like to convert this number to a capital letter.
You still will want to describe to us in one or several sentences just how you intend to convert a number to a letter -- not the code for this, but rather the logic for this -- as there is no one standard way to do this. Your post is still not clear on this point. Or perhaps it would help us if you told us just what you were going to do with the capital letter once obtained. In other words, what is the ultimate goal of this exercise?
Best of luck!
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I did not think about that. So, I guess I would need to generate a random numer within a range of 65 to 90 and then display that number. Can I designate that this letter be a capital ?fred rosenberger wrote:The problem is not how to do it, but how YOU want to do it. if you are generating a random 2-digit number, you're getting values from 00-99. which of those numbers should be displayed as what capital letter?
suppose you get a random number of 12 - what capital letter should it be?
If you want to use ASCII, you would need to generate numbers between 65 and 90 only. 12 is the ASCII code for a Form Feed - which is not any capital letter.
Ken Mullins wrote:
I did not think about that. So, I guess I would need to generate a random numer within a range of 65 to 90 and then display that number. Can I designate that this letter be a capital ?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |