把下面这个填空填好就好了(带下划线部分)importjava.util.Scanner;publicclassEncryptionFormVI{staticScannerscan=newScanner(System.in);publicstaticintmenu(){//displaysthemen...
把下面这个填空填好就好了(带下划线部分)
import java.util.Scanner;
public class EncryptionFormVI
{
static Scannerscan = new Scanner(System.in);
public static intmenu()
{ //displaysthe menu and returns the user's choice
System.out.println("Encryption/Decoder");
System.out.println("1. Encrypt");
System.out.println("2. Decode");
System.out.println("3. Quit");
System.out.print("Your choice: ");
int yourPick =scan.nextInt();
Stringbuffer=scan.nextLine(); //clears thebuffer of the leftover enter character
System.out.println();
return ________________;
}
public static _______ getMessage(________________)
{ //user enters the message that will beencrypted or decoded
System.out.print("Enter message: ");
String message= scan.nextLine();
returnmessage;
}
public static _______ code(______________ )
{ //returns the line that has been coded byshifting the characters a given distance
StringnewMessage = "";
for (inti=0;i
{
newMessage= newMessage + (char)(line.charAt(i)+shift);
}
return_______ ;
}
public static voidencrypt()
{ // gets a message that is then encrypted anddisplayed
Stringoriginal = ____________________;
System.out.println("Encrypted message: " + code(_____________));
System.out.println();
}
public static voiddecode()
{ //gets an encrypted message and decodes anddisplays the original text
Stringencrypted = ___________________;
System.out.println("Original message: " + code(_______________));
System.out.println();
}
public static voidmain(String[] args)
{
int choice = ______________;
while (choice!= 3)
{
switch(choice)
{
case 1:
________________;
break;
case 2:
________________;
break;
default:
System.out.println("error");
}
choice = ____________;
}
}
}
展开