package char03;
import java.util.*;
public class review {
public static void main (String [] args){
//判断某年某月有多少天
//大月有1、3、5、7、8、10、12 小月有4、6、9、11月
//闰年2月有29天 平年2月有28天 闰年判断能被四整除但不能被100整除,或者被400整除
Scanner input = new Scanner(System.in);
int year,month,day;
System.out.println(“请输入某年份”);
year =input.nextInt();
System.out.println(“请输入某月份”);
month =input.nextInt();
switch(month){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
day = 31;
System.out.println("该年月有"+day+"天");
break;
case 4: case 6: case 9: case 11:
day = 30;
System.out.println("该年月有"+day+"天");
}
if((year%4==0&&year%100!=0)||year%400==0){
day = 29;
System.out.println("该年月有"+day+"天");
}
else{
day = 28;
System.out.println("该年月有"+day+"天");
}
//交换值
int left =3,right =5,swap =0;
System.out.println("left="+left+"right="+right);
swap = left;
left = right;
right = swap;
System.out.println("left="+left+"right"+right);
//嫁女儿的故事
//身高每欠一公分,彩礼加3万
//体重每欠或超出一斤,彩礼加2万
//每结一次婚,彩礼加40万
final double HEIGHT =1.80;final double WEIGHT_TOP =160,WEIGHT_BOTTOM = 140,BRIDE_PRICE=88;
final char MARRIED = '否';//标准
double height =198,weight =154,married_times=1;boolean married =false;
//一个男人的个人信息
double height_price = height>=HEIGHT?0:height*10;
double weight_price = (weight<=WEIGHT_TOP&&weight>=WEIGHT_BOTTOM)?0:Math.abs((weight<WEIGHT_BOTTOM)?WEIGHT_BOTTOM:WEIGHT_TOP)*2;
double married_price = (married?0:married_times*40)+BRIDE_PRICE;
double bride_price = height_price+weight_price+married_price;
System.out.println("需要花费"+bride_price+"万元人民币");
//字符串比较大小
String a = "a",b = "b";
int rst = a.compareTo(b);
if(rst>0){
System.out.println("a>b");
}else if{
System.out.println("a<b");
}else{
System.out.println("a=b");
}
//大小写转换
// System.out.println("aBcdEfgh".toLowerCase());
//中奖
Random rand = new Random();
int fir = 10+rand.nextInt(89);
int sec = 10+rand.nextInt(89);
int tir = 10+rand.nextInt(89);
int num = 10+rand.nextInt(89);
if(num==fir){
System.out.println("恭喜你得了一等奖");
}else if(num==sec){
System.out.println("恭喜你得了二等奖");
} else if(num==tir){
System.out.println("恭喜你得了三等奖");
}else{
System.out.println("你没中奖");
}
// 随机输入三个数,比较其大小
Random rand = new Random();
int a = 10+rand.nextInt(89);
int b= 10+rand.nextInt(89);
int c = 10+rand.nextInt(89);
int min,mid,max=0;
if(a>b){
if(a>c){
if(b>c){
max = a;
mid = b;
min = c;
}else{
max = a;
mid = c;
min = b;
}
}else{
max = c;
mid = a;
min = b;
}
}
else{
if(b>c){
if(a>c){
max = b;
mid = a;
min = c;
}else{
max = b;
mid = c;
min = a;
}
}else{
max = c;
mid = b;
min = a;
}
}
System.out.println("max="+max+"mid="+mid+"min="+min);
int temp;
if(a<b){
temp =a;
a = b;
b = temp;
}
if (a<c){
temp = a;
a = c;
c = temp;
}
if (b<c){
temp = b;
b = c;
c = temp;
}
System.out.println("max="+a+"mid="+b+"min="+c);
}
}