import java.util.Scanner;
public class IfZuoYe{
public static void main(String[]args){
Scanner s = new Scanner(System.in);
//1.腾讯抽奖系统
/*System.out.println("欢迎登陆腾讯抽奖系统");
System.out.println("请输入4位数会员号码");
int a = s.nextInt();
int z = (a/10);
int b = (z%10);
int ss = (int)(Math.random()*10);
if(b<=ss){
System.out.println("恭喜中奖");
}else{
System.out.println(a+",谢谢支持");
}*/
//2.会员登陆
/*System.out.println("会员登陆,请输入用户名");
String ming= s.nextLine();
System.out.println("请输入密码");
int b= s.nextInt();
int c = 1234;
if(b==c){
System.out.println("欢迎您青");
}else{
System.out.println("对不起,您不是会员!");
}*/
//3.小孩儿搬桌
/*System.out.println("请输入年龄");
int er = s.nextInt();
System.out.println("请输入性别,男为1女为0");
int san = s.nextInt();
if(er>=7){
System.out.println("可以搬动桌子");
}else if(er>=5){
if(san==1){
System.out.println("可以搬动桌子");
}
}else{
System.out.println("不可以搬动桌子,你还太小");
}*/
//4.结业考试成绩评测
/*System.out.println("请输入成绩");
int i = s.nextInt();
if(i>=90){
System.out.println("优秀");
}else if(i>=80){
System.out.println("良好");
}else if(i>=60){
System.out.println("中等");
}else {
System.out.println("差");
}*/
//5.买车问题
/*System.out.println("请输入存款数额,单位:万");
int b = s.nextInt();
if (b>500){
System.out.println("买凯迪拉克");
}else if(b>100){
System.out.println("买帕萨特");
}else if(b>50){
System.out.println("买依兰特");
}else if(b>10){
System.out.println("买奥托");
}else{
System.out.println("买捷安特");
}*/
//6.计算会员折扣
/*System.out.println("请输入会员积分数值");
int b = s.nextInt();
if(b<2000){
System.out.println("9折");
}else if(2000<=b & b<4000){
System.out.println("8折");
}else if(4000<=b & b<8000){
System.out.println("7折");
}else if(b>=8000){
System.out.println("6折");
}*/
/*System.out.println("欢迎光临腾讯互联会员系统");
System.out.println("添加用户信息");
System.out.println("请输入会员号码《4位数》");
int a = s.nextInt();
System.out.println("请输入会员生日《日/月》");
int b = s.nextInt();
System.out.println("请输入会员积分");
int c = s.nextInt();
System.out.println("会员信息如下");
System.out.println(a+"\t"+b+"\t"+c);*/
//7.折扣计算
/*System.out.println("普通顾客为1,会员顾客为0");
System.out.println("请输入身份1或0");
int a = s.nextInt();
switch (a){
case 0:
System.out.println("满200打7.5折");
break;
default:
System.out.println("满100打8折");
}*/
//8.快速拨号
/*System.out.println("请输入数字1-4");
int a = s.nextInt();
int b = 1111;
int c = 1111;
int d = 1111;
int e = 1111;
switch(a){
case 1:
System.out.println(b);
break;
case 2:
System.out.println(c);
break;
case 3:
System.out.println(d);
break;
case 4:
System.out.println(e);
break;
}*/
//9.迷你计算器
/*System.out.println("欢迎使用简单计算器系统:");
System.out.print("请输入第一个数字:");
int yi = s.nextInt();//接收数字;
System.out.print("请输入运算符:");
String er = s.next();//接收运算符;
System.out.print("请输入第二个数字:");
int san = s.nextInt();//接收数字;
switch (er){//检测输出运算符是否与switch内运算符一致;
case "+" ://求和运算符
san = yi + san;
break;
case "-"://求差运算符
san = yi - san;
break;
case "*" ://求积运算符
san = yi * san;
break;
case "/"://求商运算符
san = yi / san;
break;
case "%"://求余数运算符
san = yi % san;
break;
}
System.out.println("运算结果为:" + yi + er + san + " = " + san);//输入结果;*/
//10.机票打折
/*int a = 5000;
System.out.println("请输入当前月份");
int b = s.nextInt();
System.out.println("请输入头等舱还是经济舱");
System.out.println("1代表头等舱2代表经济舱");
int c = s.nextInt();
double d = 0.9;//旺季头等舱9折
double e = 0.8;//旺季经济舱8折
double f = 0.5;//淡季经济舱5折
double g = 0.4;
switch(b){
case 1: case 2: case 3: case 11: case 12:
if(c==1){
System.out.println("旺季头等舱的票价"+a*d);
System.out.println("旺季经济舱的票价"+a*e);
}
default:
System.out.println("淡季头等舱的票价"+a*f);
System.out.println("淡季经济舱的票价"+a*g);
}*/
//编码题1.
/*System.out.println("请输入姓名");
String a = s.nextLine();
System.out.println("请输入年龄");
int b = s.nextInt();
System.out.println("请输入性别");
System.out.println("男为1女为0");
int c = s.nextInt();
System.out.println("你的名字:"+a);
System.out.println("你的年龄:"+b);
if(c==1){
System.out.println("你的性别:男");
}else{
System.out.println("你的性别:女");
}*/
//2.圆的周长和面积
/*System.out.println("请输入圆的半径");
double a = s.nextDouble();
final double b = 3.14;
double c = (2*b*a);
double d = (b*a*a);
System.out.println("圆的半径为:R="+a);
System.out.println("圆的周长为:C=2*3.14*"+a+"="+c);
System.out.println("圆的面积为:S=3.14*"+a+"*="+d);*/
//3.银行利率
/*System.out.println("请输入本金");
double a = s.nextInt();
double b = (a/100*0.35);
double e = (double)(a/100*0.35*2);
double c = (a/100*1.5);
System.out.println("活期一年本金总计"+(a+b));
System.out.println("定期一年本金总计"+(a+c));
System.out.println("活期一年本金总计"+(a+b));
System.out.println("活期一年本金总计"+(a+b));
*/
//4.电话加密
/*System.out.print("请输入一个四位数正整数:");
int a = s.nextInt();
int b1 = (((a%10)+5)%10);
int c2 = (((a/10%10)+5)%10);
int d3 = (((a/100%10)+5)%10);
int e4 = (((a/1000%10)+5)%10);
System.out.println("加密后的数字为:"+e4+" "+d3+" "+c2+" "+b1);
*/
//5.加密密文
System.out.println("加密前原文:十点进攻");
char a = '十';
char b = '点';
char c = '进';
char d = '攻';
char e = (char)(a^8);
char f = (char)(b^8);
char g = (char)(c^8);
char h = (char)(d^8);
System.out.println("密文:"+e+""+f+""+g+""+h);
char i = (char)(e^8);
char j = (char)(f^8);
char k = (char)(g^8);
char l = (char)(h^8);
System.out.println("解密后原文:"+i+""+j+""+k+""+l);
}
}
我的Java作业
最新推荐文章于 2024-11-04 20:33:37 发布