From d3c10cb1c39a6a7f58af1bb4527c286ee6b821bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=95=8F?= <3234934487@qq.com> Date: Tue, 27 Dec 2022 11:12:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=8D=81=E4=B8=80=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...a.\351\232\217\346\234\272\346\225\260.md" | 0 ...20221219 Java.\346\226\271\346\263\225.md" | 5 + ...71\346\263\225\345\206\205\345\256\271.md" | 94 +++++++++++++++++++ ...41\347\220\206\345\233\276\344\271\246.md" | 81 ++++++++++++++++ 4 files changed, 180 insertions(+) rename "56 \350\265\265\346\225\217/20221215 Java \351\232\217\346\234\272\346\225\260.md" => "56 \350\265\265\346\225\217/20221215 Java.\351\232\217\346\234\272\346\225\260.md" (100%) create mode 100644 "56 \350\265\265\346\225\217/20221220 Java.\346\226\271\346\263\225\345\206\205\345\256\271.md" create mode 100644 "56 \350\265\265\346\225\217/20221226 Java.\347\256\241\347\220\206\345\233\276\344\271\246.md" diff --git "a/56 \350\265\265\346\225\217/20221215 Java \351\232\217\346\234\272\346\225\260.md" "b/56 \350\265\265\346\225\217/20221215 Java.\351\232\217\346\234\272\346\225\260.md" similarity index 100% rename from "56 \350\265\265\346\225\217/20221215 Java \351\232\217\346\234\272\346\225\260.md" rename to "56 \350\265\265\346\225\217/20221215 Java.\351\232\217\346\234\272\346\225\260.md" diff --git "a/56 \350\265\265\346\225\217/20221219 Java.\346\226\271\346\263\225.md" "b/56 \350\265\265\346\225\217/20221219 Java.\346\226\271\346\263\225.md" index 43e5c77..77e820a 100644 --- "a/56 \350\265\265\346\225\217/20221219 Java.\346\226\271\346\263\225.md" +++ "b/56 \350\265\265\346\225\217/20221219 Java.\346\226\271\346\263\225.md" @@ -1,6 +1,7 @@ 作业1 ``` + public class D6{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); @@ -38,4 +39,8 @@ public class D6 { } ``` +笔记 + +``` +``` diff --git "a/56 \350\265\265\346\225\217/20221220 Java.\346\226\271\346\263\225\345\206\205\345\256\271.md" "b/56 \350\265\265\346\225\217/20221220 Java.\346\226\271\346\263\225\345\206\205\345\256\271.md" new file mode 100644 index 0000000..b322d69 --- /dev/null +++ "b/56 \350\265\265\346\225\217/20221220 Java.\346\226\271\346\263\225\345\206\205\345\256\271.md" @@ -0,0 +1,94 @@ +1.编写函数,计算圆的面积和周长,在主函数中接受圆的半径,在自定义函数中计算并输出 + +import java.util.Scanner; +public class D4 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("请输入圆的半径:"); + int bj = sc.nextInt(); + System.out.println("圆的周长是:"+zc(bj)); + System.out.println("圆的面积是:"+mj(bj)); + } + public static double zc(int bj){ + return 2*3.14*bj; + } + public static double mj(int bj){ + return 3.14*bj*bj; + } +} + +2.在主函数中产生20个0-10之间的随机数,将这20个随机数存入数组,并通过函数计算某个数在这些随机数中出现的次数(这“某个数”是在主函数中由用户输入的) + +import java.util.Arrays; +import java.util.Random; +import java.util.Scanner; +public class D5 { + public static void main(String[] args) { + int[] num = new int[20]; + for (int i=0; i<20; i++){ + Random sj=new Random(); + num[i]=sj.nextInt(10); + } + Scanner sc = new Scanner(System.in); + System.out.println("请输入某个数:"); + int x = sc.nextInt(); + sz(num,x); + } + public static void sz(int[]num,int x){ + int count=0; + for (int i=0; i