Created
August 30, 2016 10:45
-
-
Save peerapongsam/50ec86d3b6a6ff1a8f0025449bab4b79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.peerapongme.labs.java101rxjava; | |
import java.util.Scanner; | |
/** | |
* Created by peerapong on 8/22/16. | |
*/ | |
public class Program { | |
public static void main(String[] args) { | |
System.out.println("Enter characters....."); | |
Scanner scanner = new Scanner(System.in); | |
if (scanner.hasNextLine()) { | |
String str = scanner.nextLine(); | |
if (str.length() > 1) { | |
System.out.println("Invalid"); | |
} else { | |
char userChar = str.charAt(0); | |
if (userChar >= 65 && userChar <= 90) { | |
System.out.println(userChar + ": " + (userChar - 64)); | |
} else if (userChar >= 91 && userChar <= 122) { | |
System.out.println(userChar + ": " + userChar); | |
} else { | |
System.out.println("Invalid"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment