From 6efb964d241bbbbd5cb0163b1d549a7510484e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E7=90=AA?= <邓琪> Date: Wed, 14 Dec 2022 18:55:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20221213 \344\275\234\344\270\232.md" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "32 \351\202\223\347\220\252/20221213 \344\275\234\344\270\232.md" diff --git "a/32 \351\202\223\347\220\252/20221213 \344\275\234\344\270\232.md" "b/32 \351\202\223\347\220\252/20221213 \344\275\234\344\270\232.md" new file mode 100644 index 0000000..36258f0 --- /dev/null +++ "b/32 \351\202\223\347\220\252/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 -- Gitee From 044d63114b123393cc86b2af559886216c904d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E7=90=AA?= <邓琪> Date: Thu, 15 Dec 2022 19:38:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...25\347\232\204\344\275\277\347\224\250.md" | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 "32 \351\202\223\347\220\252/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" diff --git "a/32 \351\202\223\347\220\252/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" "b/32 \351\202\223\347\220\252/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" new file mode 100644 index 0000000..db9c7b2 --- /dev/null +++ "b/32 \351\202\223\347\220\252/20221215 \346\226\271\346\263\225\347\232\204\344\275\277\347\224\250.md" @@ -0,0 +1,45 @@ +### 1.方法的总结 + +- 方法有四种状态 无返回值,无参数 ; 有返回值,无参数, 无返回,有参数 ,有返回,也有参数 +- 调用方法前.一定要先定义这个方法.也就是说不能调用不存在的方法,否则报错 +- 有参数的方法,调用的时候使用的参数.称实参[具体有值],而定义方法时用的参数.称为形参,数据类型 参数名称(不具体的一个变量) +- 有返回值的方法,返回的的类型由return决定,而且调用方法时,用一个变量接收,这个变量的类型.也要和调用的方法返回的类型一致 + +### 2.作业 + +1.作业 + +~~~java + public static void main(String[] args) { + System.out.println("这是一个比大小的程序\n请输入你要比较第一个数(按回车输入下一个):"); + Scanner sc1 = new Scanner(System.in); + Scanner sc2 = new Scanner(System.in); + double c = sc1.nextDouble(); + double d = sc2.nextDouble(); + System.out.println(getMax(c,d)); + + } + public static double getMax(double a,double b){ + double max =a>b?a:b; + return max; + } +~~~ + +2.作业 + +~~~java + public static void main(String[] args) { + System.out.println("这是一个求3个数立方和的程序\n请输入第一个数(按回车输入第二个数,以此类推);"); + Scanner sc1 = new Scanner(System.in); + Scanner sc2 = new Scanner(System.in); + Scanner sc3 = new Scanner(System.in); + int x = sc1.nextInt(); + int y = sc2.nextInt(); + int z = sc3.nextInt(); + System.out.println(sum(x,y,z)); + } + + public static int sum (int x, int y,int z){ + int i = x*x*x+y*y*y+z*z*z; + return i; + } \ No newline at end of file -- Gitee