diff --git "a/08 \350\224\241\346\263\275\351\222\246/20221213 \344\275\234\344\270\232.md" "b/08 \350\224\241\346\263\275\351\222\246/20221213 \344\275\234\344\270\232.md" new file mode 100644 index 0000000000000000000000000000000000000000..36258f0b1d933a97d154ee5228530a6d5f20e0dd --- /dev/null +++ "b/08 \350\224\241\346\263\275\351\222\246/20221213 \344\275\234\344\270\232.md" @@ -0,0 +1,25 @@ +# 作业 + +~~~java +//九九乘法表倒过来 +public static void main(String[] args) { + for (int i=9; i>=1;i--){ + for (int j=9;j>=i;j--){ + System.out.print(j+"*"+i+"="+j*i+"\t"); + } + System.out.println(); + + } + } +~~~ + +~~~java + //算2,3阶段的立方 +public static void main(String[] args) { + for (int i = 1; i <= 100; i++) { + if (i * 4.05 + (100 - i) * 5.06 == 445.4){ + System.out.println("第二档:" + i + "立方,第三档是:" + (100 - i) + "立方"); + } + } + } +~~~ \ No newline at end of file diff --git "a/08 \350\224\241\346\263\275\351\222\246/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" "b/08 \350\224\241\346\263\275\351\222\246/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" new file mode 100644 index 0000000000000000000000000000000000000000..75db017ea87a8cf0a90603c09d9cb17ad0ad8de4 --- /dev/null +++ "b/08 \350\224\241\346\263\275\351\222\246/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" @@ -0,0 +1,50 @@ +### 1.方法的总结 + +- 方法有四种状态 无返回值,无参数 ; 有返回值,无参数, 无返回,有参数 ,有返回,也有参数 +- 调用方法前.一定要先定义这个方法.也就是说不能调用不存在的方法,否则报错 +- 有参数的方法,调用的时候使用的参数.称实参[具体有值],而定义方法时用的参数.称为形参,数据类型 参数名称(不具体的一个变量) +- 有返回值的方法,返回的的类型由return决定,而且调用方法时,用一个变量接收,这个变量的类型.也要和调用的方法返回的类型一致 + +### 2.作业 + +1.作业 + +~~~java + public static void main(String[] args) { + //两个数比大小,用户来输入 + Scanner sc1 = new Scanner(System.in); + Scanner sc2 = new Scanner(System.in); + System.out.println("请输入a的值"); + int a = sc1.nextInt(); + System.out.println("请输入b的值"); + int b = sc2.nextInt(); + System.out.println(bdx(a,b)); + + } + public static int bdx(int a ,int b){ + int c=a > b ? a : b; + return c; + } +~~~ + +2.作业 + +~~~java + public static void main(String[] args) { + //键盘录入接收3个数x,y,z 编写函数计算3个数的立方并返回计算结果 + Scanner sc1=new Scanner(System.in); + System.out.println("输入3个数"); + double x = sc1.nextDouble(); + Scanner sc2=new Scanner(System.in); + double y = sc2.nextDouble(); + Scanner sc3=new Scanner(System.in); + double z = sc3.nextDouble(); + + System.out.println(max(x,y,z)); + + } + public static double max(double x,double y,double z){ + double i=x*x+y*y+z*z; + return i; + + } \ No newline at end of file