Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have been hired to develop a security code program. The program should allow

ID: 3640930 • Letter: Y

Question

You have been hired to develop a security code program. The program should allow the user to enter a massage, one character at a time. The program should then display the corresponding digit or punctuation according to the ASCII character set. For example, if the user enters the letter a, the program would display the character ! (exclamation point). The program should run until the user enters a character that is not one of the corresponding digits or punctuations. This will only works for lower case letters so if the user enters an upper case letter, the program should convert it to its lower case. Please include comment throughout the program

Explanation / Answer

import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); boolean cont = true; while(cont){ System.out.println("Enter character: "); char c = sc.next().charAt(0); if(cont = Character.isLetter(c)){ //calculate distance to 'a' int distance = (Character.toLowerCase(c) - 'a'); //print out a character which is distance away from '!' in table System.out.println((char) ('!' + distance)); } } System.out.println("FInished"); } } Hope you lie it

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote