Create a program that requests a phrase by keyboard and displays on the screen the position of the character that has a higher ASCII value. The program must validate that the phrase written by the user does not have any of the following symbols: $, & or #. If any of these symbols are present, the program should show an error message and finish its execution.
It is the program to be developed and I have this done:
package errores2;
public class ascii {
String cadena;
private int i;
public void splitcadena(){
try{
for(int i=0;i<cadena.length();i++){
int as=cadena.charAt(i);
}
} catch(Exception a){
// catch error a
}
}
}
package errores2;
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner read=new Scanner(System.in);
ascii q=new ascii();
System.out.println("Digite frase a convertir");
q.cadena=read.nextLine();
q.splitcadena();
}
}