diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo01.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo01.java" new file mode 100644 index 0000000000000000000000000000000000000000..6560ff522e8b26fe956c4d73959946fd187094f6 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo01.java" @@ -0,0 +1,30 @@ +package com.md.Lessions08; + +import java.util.Scanner; + +public class Demo01 { + + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + double sum = 0; + double price; + while(true) { + System.out.println("请输入金额:"); + price =scan.nextDouble(); + if(price<=0&&price!=-1) { + System.err.println("报错信息"); + continue;} + + if(price==-1) { + + break; + }sum+=price; + + }System.err.println("sum"+sum); + System.out.println("end"); + + + + + +}} \ No newline at end of file diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo02.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo02.java" new file mode 100644 index 0000000000000000000000000000000000000000..d472942b6e6087c05ae52eccadd097690232e04a --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo02.java" @@ -0,0 +1,16 @@ +package com.md.Lessions08; + +public class Demo02 { + + public static void main(String[] args) { + //猴子吃桃 + int a =1; + + for (int i = 1; i < 10; i++) { + a=(a+1)*2; + System.out.println("第"+(10-i)+"天,桃子数是:"+a); +} + System.out.println("最终结果是:"+a); + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo03.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo03.java" new file mode 100644 index 0000000000000000000000000000000000000000..fa7630ffc4363a43715b3273579d323f0c700afd --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo03.java" @@ -0,0 +1,22 @@ +package com.md.Lessions08; + +public class Demo03 { + + public static void main(String[] args) { + // 水仙花 + int a; + int b; + int c; + + for (int i = 100; i <=999; i++) { + a=i/100; + b=i/10; + b=b%10; + c=i%10; + if(a*a*a+b*b*b+c*c*c==i) { + System.out.println(i); + } + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo04.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo04.java" new file mode 100644 index 0000000000000000000000000000000000000000..1cd63983bc630d1a8e544acf5572bf892e17323f --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo04.java" @@ -0,0 +1,19 @@ +package com.md.Lessions08; + +public class Demo04 { + + public static void main(String[] args) { + for (int i = 1; i <=9; i++) { + for (int j = 1; j < 9; j++) { + if(!(j>i)) { + System.out.print(i+"*"+j+"="+i*j+"\t"); + + } + + } + System.out.println(); + } + + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo05.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo05.java" new file mode 100644 index 0000000000000000000000000000000000000000..5c54ebb03bad189a3629791c9ac1da54dc60e528 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo05.java" @@ -0,0 +1,21 @@ +package com.md.Lessions08; + +import java.util.Scanner; + +public class Demo05 { + + public static void main(String[] args) { + // 实心正方形 + Scanner scan = new Scanner(System.in); + System.out.println("请输入正方形的边长"); + int a = scan.nextInt(); + for (int i = 0; i < a; i++) { + for (int j = 0; j < a; j++) { + + System.out.print(" *"); + } + System.out.println(); + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo06.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo06.java" new file mode 100644 index 0000000000000000000000000000000000000000..fcae21ef7c87bd2e1eb1f6559c936620cfcb7764 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo06.java" @@ -0,0 +1,28 @@ +package com.md.Lessions08; + +import java.util.Scanner; + +public class Demo06 { + + public static void main(String[] args) { + //空心正方形 + Scanner scan = new Scanner(System.in); + System.out.println("请输入正方形的边长"); + int a = scan.nextInt(); + for (int i = 0; i < a; i++) { + for (int j = 0; j < a; j++) { + if(j==0||j==a-1||i==0||i==a-1) { + + System.out.print(" *"); + + + }else { + System.out.print(" "); + } + + } System.out.println(); + + } + } + +} diff --git "a/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo07.java" "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo07.java" new file mode 100644 index 0000000000000000000000000000000000000000..6f1d13fb9d38a005fb77ae49bd2a88dea19416e3 --- /dev/null +++ "b/Java\347\254\254\345\205\253\346\254\241\344\275\234\344\270\232/\345\210\230\346\200\235\347\233\210/Demo07.java" @@ -0,0 +1,11 @@ +package com.md.Lessions08; + +public class Demo07 { + + public static void main(String[] args) { + //开发部分员工年龄 + int[] a= new int[5]; + + } + +}