- package com.Java.Basics1;
-
- public class as {
-
- public static void main(String[] args) {
- System.out.println("今天是你的回顾期第一天,走进java程序员");
- System.out.println("java程序第一课");
- System.out.println("思考一下3*5用java语言用什么输出呢");
-
- int a=3;
- int b=5;
- int c=a*b;
- System.out.println("3*5=15"+a*b);
- System.out.println(c);
- System.out.println("================");
- byte aa=123;
- short ba=32564;
- int ca=4578662;
- long da=467896123;
- long ea=aa+ba+ca+da;
- System.out.println(aa);
- System.out.println(ba);
- System.out.println(ca);
- System.out.println(da);
- System.out.println(ea);
- System.out.println(aa/8);
- System.out.println(ba*8);
- System.out.println(ca+45692);
- System.out.println(da-45623);
- System.out.println(ea^45);
-
- int aaa=13;
- if(aaa>12) {
- System.out.println("I IOVER YOU");
- }
-
-
- }
-
- }
-
- package com.Java.Basics1;
-
- public class ComB {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int number1=6;
- int number2=7;
- int number3=34;
- int c=2;
- int v=5;
- boolean result=((c>v)&&(c!=v));
- boolean result1=((c>v)||(c!=v));
- System.out.println(result);
- System.out.println(result1);
- System.out.println((number1>number2));
- System.out.println("===1==");
- System.out.println((number1<number2));
- System.out.println("===2==");
- System.out.println((number1==number3));
- System.out.println("===3==");
- System.out.println((number1!=number2));
- System.out.println("==4===");
- System.out.println((number1>=number2));
- System.out.println("===5==");
- System.out.println((number1<=number2));
-
-
- }
-
- }
- package com.Java.Basics1;
-
- public class ComD {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- /*
- * if else 语句
- */
- int math =102;
- int english=120;
- if(math>110) {
- System.out.println("66666");
- }else {
- System.out.println("les go");
- }
-
- if(english<110) {
- System.out.println("66666");
- }else {
- System.out.println("les go");
- }
- /*
- * if()else....if()else 多分支
- */
- int x=20;
- if(x>30) {
- System.out.println("a>30");
- }else if(x>20) {
- System.out.println("a>20 ||a<10");
- }else if (x>0) {
- System.out.println("a<0");
- }else {
- System.out.println("a>>0");
- }
- /*
- * switch case break default 语句 一
- */
- String str="今朝有酒1";
- switch(str) {
- case "今":
- System.out.println("7");
- break;
- case"朝":
- System.out.println("4");
- break;
- case"有":
- System.out.println("3");
- break;
- case"今朝有酒":
- System.out.println("今朝有酒 今朝有酒");
- break;
- default:
- System.out.println("i donot know");
-
- }
-
- /*
- * switch case break default
- */
- int week=7;
- switch (week) {
- case 0:
- System.out.println("1");
- break;
- case 1:
- System.out.println("1");
- break;
- case 2:
- System.out.println("1");
- break;
- case 3:
- System.out.println("1");
- break;
- case 4:
- System.out.println("1");
- break;
- case 5:
- System.out.println("1");
- break;
- case 6:
- System.out.println("1");
- break;
- case 7:
- System.out.println("sunday");
- break;
- default:
- System.out.println("0k not see you");
- }
- /*
- * while()
- */
- int y=1;
- int sum=0;
- while (y<=10) {
- sum=sum+y;
- y++;
- }
- System.out.println("1到10的和"+sum);
-
-
- }
-
- }
- package com.Java.Basics1;
-
- public class ComE {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int a=12;
- while (a==1) {
- System.out.println("ok1");
- a--;
- }
-
- int b=1;
- do {
- System.out.println("okr");
- b++;
- }while(b==10);
- }
- int sum=0;
-
- }
- package com.Java.Basics1;
-
- public class ComF {
-
- public static void main(String[] args) {
- /*
- * for语句
- */
- int sum=0;
- for (int i = 0; i < 6; i++) {
- sum=sum+i;
- System.out.println("hellow world");
- }
- System.out.println(sum);
- System.out.println("-==========");
-
- for (int g = 0; g < 3; g++) {
- for (int h = 0; h < 6; h++) {
- if(h==4) {
- break;
- }
- System.out.println("g="+g+h + "h="+g);
- }
-
- }
- for (int k = 0; k <28; k++) {
- if(k%2==0) {
- continue;
- }
- System.out.println(k+" "+"k%2≠0");
- }
- }
- }
- package com.eng;
-
- public class Eng4 {
- public static void main (String[]args) {
- //1
- int age=20;
- boolean result=age>=18?(true):(false);
- System.out.println(age);
- //2
- class masx{
- {
- int g =2;
- System.out.println(g);
- }
- {
- int g =2;
- System.out.println(g);
- }
-
- {
- int g =2;
- System.out.println(g);
- }
- {
- int g =2;
- System.out.println(g);
- }
- }
-
-
- }
-
-
-
- }
- package com.eng;
- import java.util.Scanner;
-
-
- public class Eng6 {
- public static void main (String[]args) {
- Scanner sc = new Scanner (System.in);
- System.out.print("请输入你的消费金额:");
- double sMoney = sc.nextDouble();
- if (sMoney<=0) {
- System.out.println("你输入有!!!!!");
- }else if(sMoney<50) {
- System.out.println("换购活动需要50元,谢谢你的参加");
- }else if(sMoney>=50){
- System.out.println("1 满50元, 加2瓶可乐");
- System.out.println("2 满100元 ,加3瓶酸奶");
- System.out.println("3 满100元,有10元面粉");
- System.out.println("4 满200元,30元的喝喝");
- System.out.println("5 满100元, 加5本子");
- System.out.println("6 满300元, 加15个本子算20元");
- System.out.println("0 不换");
- System.out.println("请输入你的序号");
- int a =sc.nextInt();
- if(a>5 ||a<0) {
- System.out.print("你输入有误!如有需要轻重开始");
- }else {
- if(a==6 && sMoney>=200) {
- System.out.println("满300元, 加15本子");
- System.out.println("本次消费总额为:"+(sMoney+40));
- }else if(a==5 && sMoney>=100) {
- System.out.println(" 满100元,90元的喝喝");
- System.out.println("本次消费总额为:"+(sMoney+45));
- }else if(a==4 && sMoney>=200) {
- System.out.println(" 满200元,30元的喝喝");
- System.out.println("本次消费总额为:"+(sMoney+30));
- }else if(a==3 && sMoney>=100) {
- System.out.println(" 满100元,有10元面粉");
- System.out.println("本次消费总额为:"+(sMoney+10));
- }else if(a==2 && sMoney>=100) {
- System.out.println(" 满100元 ,加3瓶酸奶");
- System.out.println("本次消费总额为:"+(sMoney+19));
- }else if(a==1 && sMoney>=50) {
- System.out.println(" 满50元, 加2瓶可乐");
- System.out.println("本次消费总额为:"+(sMoney+4));
-
- }else if(a==0 ) {
- System.out.println("欢迎光临!!!");
- }else {
- System.out.println("你没有达到相应金额");
-
- }
- }
- }
- }
-
- }
- package com.eng;
-
- public class Eng7 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- for(int i=1;i<=9;++i){
-
- for(int j=1;j<=i;++j){
- System.out.print(i+"*"+j+"="+i*j+" ");
- }
- System.out.println();
- }
- }
-
- }
-
- package com.eng;
-
- public class Eng9 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //1
- int i = 10;
- while(i>=0){
- System.out.println(i);
- --i;
- }
- //2
- for(int a =1;a<=10;a =a+1){
- System.out.println(a);
-
- }
- //3
- int a = 1;
- while (a<=1000){
- if(a%2==0){
- System.out.println(a);
- }
- a++;
- }
- //4
- int f=1;
- do{
- System.out.println(f);
- ++f;
- }while(f<=100);
- //5
- int h =1;
- int j =1;
-
- do{
- System.out.println(j);
-
- j =j+4;
- h++;
-
- }while(h<=50);
- //6
- int t =1;
- int sum =0;
-
-
- do{
- System.out.println(t);
-
- sum =sum+t;
- ++t;
- }while(t<=100);
- System.out.println(sum);
- }
-
- }
-
-
- package com.eng;
-
- import java.util.Scanner;
-
- public class Eng10 {
- public static void main(String[] args) {
- //1.创建Scanner对象
- Scanner scanner = new Scanner(System.in);
- //2.提示用户输入年份并且获取年份
- System.out.println("请输入年份");
- int year = scanner.nextInt();
- //3.提示用户输入月份并且获取月份
- System.out.println("请输入月份");
- int month = scanner.nextInt();
-
- //4.提示用户输入日期并且获取日期
- System.out.println("请输入日期");
- int day = scanner.nextInt();
- //请输入时间
- System.out.println("请输入时间");
- int house =scanner.nextInt();
- //5.定义一个变量去统计一共过了多少天
- int sum = 0;
- switch(month){
-
- case 12:
- if(month==12){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 11:
- if(month==11){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+30;
- }
- case 10:
- if(month==10){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 9:
- if(month==9){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+30;
- }
- case 8:
- if(month==8){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 7:
- if(month==7){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 6:
- if(month==6){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+30;
- }
- case 5:
- if(month==5){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 4:
- if(month==4){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+30;
- }
- case 3:
- if(month==3){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
- case 2:
- if(month==1){
- sum = sum+day;
- }else{//过满了整月并且要判断是闰年还是平年
-
- if((year%400==0)||(year%4==0&&year%100!=0)){//闰年
- sum = sum+29;
- }else{//平年
- sum = sum+28;
- }
- }
- case 1:
- if(month==1){
- sum = sum+day;
- }else{//过满了整月
- sum = sum+31;
- }
-
- }
-
-
- int sum1= 0;
- switch(house){
-
- case 1:
- if(house==1){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = 1;
-
- }
- case 2:
- if(house==2){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 3:
- if(house==3){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 4:
- if(house==4){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 5:
- if(house==5){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 6:
- if(house==6){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 7:
- if(house==7){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 8:
- if(house==8){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 9:
- if(house==9){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 10:
- if(house==10){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 11:
- if(house==11){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 12:
- if(house==12){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 13:
- if(house==13){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 14:
- if(house==14){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 15:
- if(house==15){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 16:
- if(house==16){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 17:
- if(house==17){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 18:
- if(house==18){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 19:
- if(house==19){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 20:
- if(house==20){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 21:
- if(house==21){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 22:
- if(house==22){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
- }
- case 23:
- if(house==23){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
- case 24:
- if(house==24){
- sum1 = sum1+house;
- }else{//过满了整月
- sum1 = sum1+1;
-
- }
-
-
- System.out.println(year+"年"+month+"月"+day+"日是该年的第"+sum+"天"+"小时的时间"+sum1);
- System.out.println("-------------------------------------------------");
- System.out.println(year+"年"+month+"月"+day+"日是该年的第"+sum+"天"+"时间"+sum1);
-
- System.out.println(year+"年"+month+"月"+day+"日是该年的第"+sum+"天"+"小时的时间"+sum1);
- System.out.println("-------------------------------------------------");
- System.out.println(year+"年"+month+"月"+day+"日是该年的第"+sum+"天"+"时间"+sum1);
-
-
- }
-
-
-
-
- }
- }
-
-
-
-