This is my first post. I also just started. We are supposed to use method calling to get an integer from the user and then use the value inputted in another method and convert it into a ASCII character. This is what I have -
public static void main(String[] args) {
System.out.println(
"*** You will enter values in the range of 33-126 for the whole numbers and 33.0-126.0 for the real numbers***");
System.out.println("");
System.out.println("The number is " + getWholeNumber() +
" and the character for this is a(n) " + printCharacter());
}
public static int getWholeNumber() {
int getWholeNumber;
System.out.println("Enter a whole number, one that does not have a decimal point: ");
Scanner input = new Scanner(System.in);
getWholeNumber = input.nextInt();
return getWholeNumber;
}
public static void printCharacter(int getWholeNumber) {
char letter = (char) getWholeNumber();
System.out.println(letter);
}
I have successfully called the method and displayed the wholenumber but cannot seem to figure out how to convert that to the ASCII character represented by the number.
java.lang.Characterthen see method toString(int)