密码java_java密码代码

把下面这个填空填好就好了(带下划线部分)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 = ____________;

}

}

}

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值