javase-第六天作业

任务1:

	//键盘输入
		Scanner sc=new Scanner(System.in);
		int age=sc.nextInt();
		if(age>18) {
			System.out.println("你是一个成年人了");
		}

任务2:

		System.out.println("---进入程序--3---");
		//键盘输入
		Scanner sc=new Scanner(System.in);
		
		//循环判断输入的值是否正确
		for(;;) {
			System.out.println("输入账号和密码,账号和密码一致时可进入程序");
			System.out.print("输入账号:");
			int account=sc.nextInt();
			System.out.print("输入密码:");
			int password=sc.nextInt();
			if(password==account) {
				System.out.println("输入正确");
				break;
			}
			else {
				System.out.println("输入错误,请重新输入");
			}

任务3:

		System.out.println("请输入金额:");
		Scanner sc=new Scanner(System.in) ;
		
		int A=sc.nextInt();
		if(A>=0&&A<=200000) {
			System.out.println("暂时不买车");
		}
		else if(A>200000&&A<=500000) {
			System.out.println("买大众");
		}
		else if(A>500000&&A<=1000000) {
			System.out.println("买奔驰");
		}

任务4:

1:空

2:

		for (int a = 1; a<100; a++)
		{
			if(a%10==0) {
				System.out.println();
			}

		System.out.printf("%10d",a);

		}

3:空

4:

		Scanner sc=new Scanner(System.in);
		System.out.println("请输入行数");
		int length=sc.nextInt();
		//三角形行数循环输出(高)
		for(int i=1;i<=length;i++) {
			//三角形空白输出,每行循环输出次数
			//三角形每行的边,每行多出一个位所以输出次数-1
			for(int a=length-i;a>0;a--) {
				System.out.print(" ");
			}
			//输出三角形体
			//输出个数为当前行高的两倍减1
			for(int b=0;b<2*i-1;b++) {
				System.out.print("*");
			}
			System.out.println();
		}

5:空

6:

			System.out.print("输入账号:");
			int account=sc.nextInt();
			Integer account1=account;
			System.out.print("输入密码:");
			int password=sc.nextInt();
			Integer password1=password;
			if(password1.toString().length()<6||password1.toString().length()<16&&account1.toString().length()>6||account1.toString().length()<16) {
				
				System.out.println("账号是:"+account+"密码是:"+password);
				break;
			}
			else {
				System.out.println("请重新输入账号和密码");
				
			}

7:空

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值