public class EncryptedMessageApp
extends Object
Modifier and Type | Field and Description |
---|---|
private Scanner |
scanner
Holds the scanner object, that is connected to System.in in the constructor.
|
Constructor and Description |
---|
EncryptedMessageApp() |
Modifier and Type | Method and Description |
---|---|
private void |
askPrompt()
Simply prints
|
private void |
printExit()
Prints an exit message.
|
private void |
printSplash()
Prints a splash screen.
|
void |
run()
The part that does the work of the program.
|
private void |
typePrompt()
Prints the value from
StringManipulator.OPTIONS with a colon and
space. |
private final Scanner scanner
private void askPrompt()
Enter Message:There is a single space after the colon. Make sure to use print and not println.
private void printExit()
private void printSplash()
public void run()
printSplash()
and printExit()
, but in the
middle, will loop until exit is typed into the message request.
The program execution can look as follows
=== Practical 2 === Enter Message: Hello World Cipher,Encode,Compress: cipher:1 Ifmmp!Xpsme Enter Message: Hello World Cipher,Encode,Compress: compress Hll Wrld Enter Message: exit Have fun!
Notice it continues to loop, ask for the user input, and then calls StringManipulator.manipulate(String, String)
once both inputs are provided.
scanner
will be needed. in particular .nextLine()
private void typePrompt()
StringManipulator.OPTIONS
with a colon and
space. We used printf, but you can use what you want.