new semester, new repo structure
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package practiceexam2;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class CharsToUnicodeWhile {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// Define variables
|
||||
String toUnicode = "";
|
||||
|
||||
// Create scanner
|
||||
Scanner input = new Scanner(System.in);
|
||||
|
||||
while (!toUnicode.toLowerCase().equals("q")) {
|
||||
// Prompt for input
|
||||
System.out.print("Enter a string of characters to convert them to UNICODE or Q/q to quit this program: ");
|
||||
toUnicode = input.next();
|
||||
if (toUnicode.toLowerCase().equals("q")) {
|
||||
break;
|
||||
}
|
||||
System.out.print(toUnicode + " in UNICODE is: ");
|
||||
for (int x = 0; x < toUnicode.length(); x++) {
|
||||
System.out.print(((int) toUnicode.charAt(x)) + " ");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
System.out.println("Goodbye!");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user