昨天伪登录的进阶修改版!!!

package ktls;


import java.util.Scanner;


public class Vertual {


public static void main(String[] args) {
// TODO Auto-generated method stub
String userName = "lxy";
int passWords = 12345;
int flag = 1;


while (true) {
boolean exit = false;
System.out.println("请输入账号:");
Scanner scan = new Scanner(System.in);
String user = scan.next();
System.out.println("请输入密码:");
int pass = scan.nextInt();
if (!user.equals(userName)) {
System.out.println("输入用户名错误");
} else if (passWords == pass) {
System.out.println("登陆成功");
while (true) {
System.out.println("请输入一个字母(a-f)");
String se = scan.next();
switch (se) {
case "a":
fangKuai();
break;
case "b":
xiaYouSJ();
break;
case "c":
shangYouSJ();
break;
case "d":
zhengSJ();
break;
case "e":
linXin();
break;
case "f":
exit = true;
System.out.println("退出");
break;
}
if (exit) {
break;
}
}
} else {
System.out.println("输入密码错误");
}
if (flag == 3) {
break;
}
flag++;
}
System.out.println("你输入的错误次数过多,禁止输入!");
}


public static void fangKuai() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
System.out.print("*");
if (j == 3) {
System.out.println("\t");
}
}
}
}


public static void xiaYouSJ() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j <= i; j++) {
System.out.print("*");
}
}
}


public static void shangYouSJ() {
for (int i = 0; i <= 4; i++) {
for (int j = 1; j <= 4 - i; j++) {
System.out.print("*");
}
System.out.println("");
}
}


public static void zhengSJ() {
for (int i = 1; i <= 4; i++) {
for (int m = 0; m <= 4 - i; m++) {
System.out.print(" ");
}
for (int j = 1; j <= 2 * i - 1; j++) {
System.out.print("*");
}
System.out.println();
}
}


public static void linXin() {
for (int i = 1; i <= 4; i++) {
for (int m = 0; m <= 4 - i; m++) {
System.out.print(" ");
}
for (int j = 1; j <= 2 * i - 1; j++) {
System.out.print("*");
}
System.out.println();
}


for (int i = 1; i <= 4; i++) {
for (int m = 0; m <= i; m++) {
System.out.print(" ");
}
for (int j = 1; j <= 7 - 2 * i; j++) {
System.out.print("*");
}
System.out.println();
}


}


}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值