From 444069d012efaa7e81fd306b03f19e4c62ea3c0c Mon Sep 17 00:00:00 2001 From: suibian Date: Mon, 4 Sep 2023 16:52:51 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E7=A7=A6=E5=9B=BD=E4=BC=9F-=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apractice/mathDemo.java | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/Apractice/mathDemo.java diff --git a/src/Apractice/mathDemo.java b/src/Apractice/mathDemo.java new file mode 100644 index 0000000..12bad1c --- /dev/null +++ b/src/Apractice/mathDemo.java @@ -0,0 +1,84 @@ +package Apractice; + +/** + * @author QGW + * @version . + * @Time: + */ +import org.junit.jupiter.api.Test; + +import java.util.Scanner; + +public class mathDemo { + + public static void main(String[] args) { + + System.out.println(jiecheng()); + System.out.println(jiecheng()); + System.out.println(jiecheng1()); + + } + @Test + public void jishu(){ + //1到100之间所有奇数的平方和 + int sum = 0; + for (int i = 1; i < 101; i++) { + if (i % 2 != 0){ + sum = sum + i * i; + System.out.println(i + " " + sum); + } + } + } + @Test + public void printzhi() { + //第一个质数起,列出100个质数(十行十列) + boolean isFlag = true; + int count = 0; + for (int i = 2;; i++) { + for (int j = 2; j < i; j++) { + if (i % j == 0) { + isFlag = false; + break; + } + } + + if (isFlag) { + System.out.print(i + " "); + count++; + //满⑩换行 + if (count % 10 == 0) + System.out.println(); + } + + // 重置isFlag + isFlag = true; + + //输出100个退出循环 + if (count == 100) + break; + } + } + + //定义函数,求取正整数N的阶乘 + public static int jiecheng(){ + System.out.println("输入正整数"); + Scanner scanner = new Scanner(System.in); + int N = scanner.nextInt(); + int s = 1; + for (int i = N; i >= 1 ; i--) { + s *= i; + } + return s; + } + + //调用函数求取正整数9的阶乘 + public static int jiecheng1(){ + int s = 1; + for (int i = 9; i >= 1 ; i--) { + s *= i; + } + return s; + } +} + + -- Gitee From e1be6d5f83c417bf2aebbd61292ca93029f31670 Mon Sep 17 00:00:00 2001 From: suibian Date: Mon, 4 Sep 2023 17:05:48 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E7=A7=A6=E5=9B=BD=E4=BC=9F-=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apractice/mathDemo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apractice/mathDemo.java b/src/Apractice/mathDemo.java index 12bad1c..31ba7b1 100644 --- a/src/Apractice/mathDemo.java +++ b/src/Apractice/mathDemo.java @@ -2,7 +2,7 @@ package Apractice; /** * @author QGW - * @version . + * @version 1.1 * @Time: */ import org.junit.jupiter.api.Test; -- Gitee From 520811d267082977c40c4b0b70ff2819e294a43a Mon Sep 17 00:00:00 2001 From: suibian Date: Mon, 4 Sep 2023 17:09:23 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E7=A7=A6=E5=9B=BD=E4=BC=9F-=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apractice/mathDemo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apractice/mathDemo.java b/src/Apractice/mathDemo.java index 31ba7b1..cad5d0c 100644 --- a/src/Apractice/mathDemo.java +++ b/src/Apractice/mathDemo.java @@ -2,7 +2,7 @@ package Apractice; /** * @author QGW - * @version 1.1 + * @version 1.2 * @Time: */ import org.junit.jupiter.api.Test; -- Gitee From 0eb471cee16d3290d78ea8231f9ccc4545ea018e Mon Sep 17 00:00:00 2001 From: suibian Date: Mon, 4 Sep 2023 17:35:44 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=A7=A6=E5=9B=BD=E4=BC=9F-=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apractice/mathDemo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apractice/mathDemo.java b/src/Apractice/mathDemo.java index cad5d0c..5884d20 100644 --- a/src/Apractice/mathDemo.java +++ b/src/Apractice/mathDemo.java @@ -2,7 +2,7 @@ package Apractice; /** * @author QGW - * @version 1.2 + * @version 1.3 * @Time: */ import org.junit.jupiter.api.Test; -- Gitee From 109b7c2a34538a397f1b62d119c5fa262e079112 Mon Sep 17 00:00:00 2001 From: qinguowei114 <1316083912@qq.com> Date: Tue, 5 Sep 2023 08:25:37 +0800 Subject: [PATCH 5/9] qgw --- src/com/demo1/Test.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/com/demo1/Test.java diff --git a/src/com/demo1/Test.java b/src/com/demo1/Test.java new file mode 100644 index 0000000..bc2d14c --- /dev/null +++ b/src/com/demo1/Test.java @@ -0,0 +1,20 @@ +package com.demo1; + +public class Test { + public Test() { + Inner inner = new Inner(); + inner.a = 10; + System.out.println(inner.a); + Inner inner1 = new Inner(); + System.out.println(inner1.a); + } + class Inner{ + public int a = 1; + } + + public static void main(String[] args) { + Test test = new Test(); + Inner R = test.new Inner(); + System.out.println(R.a); + } +} -- Gitee From 3eaa5f1d60ee3a0088682148eb1d978d93158e2a Mon Sep 17 00:00:00 2001 From: zyl Date: Tue, 5 Sep 2023 08:47:45 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mathDemo.java | 84 --------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 mathDemo.java diff --git a/mathDemo.java b/mathDemo.java deleted file mode 100644 index e935f87..0000000 --- a/mathDemo.java +++ /dev/null @@ -1,84 +0,0 @@ -package Apractice; - -/** - * @author QGW - * @version 1.9 - * @Time: - */ -import org.junit.jupiter.api.Test; - -import java.util.Scanner; - -public class mathDemo { - - public static void main(String[] args) { - - System.out.println(jiecheng()); - System.out.println(jiecheng()); - System.out.println(jiecheng1()); - - } - @Test - public void jishu(){ - //1到100之间所有奇数的平方和 - int sum = 0; - for (int i = 1; i < 101; i++) { - if (i % 2 != 0){ - sum = sum + i * i; - System.out.println(i + " " + sum); - } - } - } - @Test - public void printzhi() { - //第一个质数起,列出100个质数(十行十列) - boolean isFlag = true; - int count = 0; - for (int i = 2;; i++) { - for (int j = 2; j < i; j++) { - if (i % j == 0) { - isFlag = false; - break; - } - } - - if (isFlag) { - System.out.print(i + " "); - count++; - //满⑩换行 - if (count % 10 == 0) - System.out.println(); - } - - // 重置isFlag - isFlag = true; - - //输出100个退出循环 - if (count == 100) - break; - } - } - - //定义函数,求取正整数N的阶乘 - public static int jiecheng(){ - System.out.println("输入正整数"); - Scanner scanner = new Scanner(System.in); - int N = scanner.nextInt(); - int s = 1; - for (int i = N; i >= 1 ; i--) { - s *= i; - } - return s; - } - - //调用函数求取正整数9的阶乘 - public static int jiecheng1(){ - int s = 1; - for (int i = 9; i >= 1 ; i--) { - s *= i; - } - return s; - } -} - - -- Gitee From 4c7f0885cabebb2bb5cbf49ea9a193659fc9038d Mon Sep 17 00:00:00 2001 From: qinguowei114 <1316083912@qq.com> Date: Tue, 5 Sep 2023 10:02:20 +0800 Subject: [PATCH 7/9] qgw --- .idea/libraries/KotlinJavaRuntime.xml | 7 + .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/uiDesigner.xml | 124 +++++++++++++++++ .idea/vcs.xml | 8 ++ qgw.iml | 55 ++++++++ src/Main.java | 2 + src/TEST.java | 10 ++ src/TankWar/gameVer02.java | 8 ++ src/chapter10/HomeWork2/Frock.java | 33 +++++ src/chapter10/HomeWork3/Test1.java | 31 +++++ src/chapter10/HomeWork4/jisuan.java | 39 ++++++ src/chapter10/HomeWork4/suan.java | 28 ++++ src/chapter10/HomeWork6/test.java | 54 ++++++++ src/chapter10/Practice.java | 27 ++++ src/chapter10/Test1_Static.java | 41 ++++++ src/chapter14/hashmapexe.java | 66 +++++++++ src/com/com/LingQianTon.java | 83 ++++++++++++ src/com/com/OOPlqt.java | 10 ++ src/com/com/ways.java | 105 +++++++++++++++ src/com/demo/inner.java | 30 +++++ src/com/demo/out.java | 15 +++ src/com/demo/www.java | 27 ++++ src/com/demo1/ia.java | 5 + src/com/extend/father.java | 20 +++ src/com/extend/grandpa.java | 17 +++ .../demo/\345\220\214\345\214\205.java" | 14 ++ .../demo/\350\207\252\350\272\253.java" | 15 +++ ...\346\204\217\345\234\260\346\226\271.java" | 14 ++ .../demo1/\347\273\247\346\211\277.java" | 14 ++ .../UseInterface.java" | 12 ++ .../\346\216\245\345\217\243demo/test.java" | 5 + src/houseRent/house.java | 17 +++ src/houseRent/houseSys.java | 127 ++++++++++++++++++ src/houseRent/main.java | 7 + src/preHomeWork/homework/HomeWork1.java | 100 ++++++++++++++ .../homework/HomeWork13/Person.java | 45 +++++++ .../homework/HomeWork13/Student.java | 63 +++++++++ .../homework/HomeWork13/Teacher.java | 64 +++++++++ src/preHomeWork/homework/HomeWork13/main.java | 34 +++++ src/preHomeWork/homework/HomeWork3.java | 85 ++++++++++++ src/preHomeWork/homework/HomeWork4.java | 49 +++++++ .../.idea/misc.xml" | 6 + .../.idea/modules.xml" | 8 ++ .../.idea/vcs.xml" | 6 + ...6\344\271\240\346\227\245\345\277\227.iml" | 9 ++ 46 files changed, 1553 insertions(+) create mode 100644 .idea/libraries/KotlinJavaRuntime.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 qgw.iml create mode 100644 src/Main.java create mode 100644 src/TEST.java create mode 100644 src/TankWar/gameVer02.java create mode 100644 src/chapter10/HomeWork2/Frock.java create mode 100644 src/chapter10/HomeWork3/Test1.java create mode 100644 src/chapter10/HomeWork4/jisuan.java create mode 100644 src/chapter10/HomeWork4/suan.java create mode 100644 src/chapter10/HomeWork6/test.java create mode 100644 src/chapter10/Practice.java create mode 100644 src/chapter10/Test1_Static.java create mode 100644 src/chapter14/hashmapexe.java create mode 100644 src/com/com/LingQianTon.java create mode 100644 src/com/com/OOPlqt.java create mode 100644 src/com/com/ways.java create mode 100644 src/com/demo/inner.java create mode 100644 src/com/demo/out.java create mode 100644 src/com/demo/www.java create mode 100644 src/com/demo1/ia.java create mode 100644 src/com/extend/father.java create mode 100644 src/com/extend/grandpa.java create mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" create mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" create mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" create mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" create mode 100644 "src/com/\346\216\245\345\217\243demo/UseInterface.java" create mode 100644 "src/com/\346\216\245\345\217\243demo/test.java" create mode 100644 src/houseRent/house.java create mode 100644 src/houseRent/houseSys.java create mode 100644 src/houseRent/main.java create mode 100644 src/preHomeWork/homework/HomeWork1.java create mode 100644 src/preHomeWork/homework/HomeWork13/Person.java create mode 100644 src/preHomeWork/homework/HomeWork13/Student.java create mode 100644 src/preHomeWork/homework/HomeWork13/Teacher.java create mode 100644 src/preHomeWork/homework/HomeWork13/main.java create mode 100644 src/preHomeWork/homework/HomeWork3.java create mode 100644 src/preHomeWork/homework/HomeWork4.java create mode 100644 "\345\256\236\344\271\240\346\227\245\345\277\227/.idea/misc.xml" create mode 100644 "\345\256\236\344\271\240\346\227\245\345\277\227/.idea/modules.xml" create mode 100644 "\345\256\236\344\271\240\346\227\245\345\277\227/.idea/vcs.xml" create mode 100644 "\345\256\236\344\271\240\346\227\245\345\277\227/.idea/\345\256\236\344\271\240\346\227\245\345\277\227.iml" diff --git a/.idea/libraries/KotlinJavaRuntime.xml b/.idea/libraries/KotlinJavaRuntime.xml new file mode 100644 index 0000000..d2eaa8c --- /dev/null +++ b/.idea/libraries/KotlinJavaRuntime.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..264c5df --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..5183a2d --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/qgw.iml b/qgw.iml new file mode 100644 index 0000000..75bd9a6 --- /dev/null +++ b/qgw.iml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java new file mode 100644 index 0000000..7046417 --- /dev/null +++ b/src/Main.java @@ -0,0 +1,2 @@ +public class Main { +} diff --git a/src/TEST.java b/src/TEST.java new file mode 100644 index 0000000..e7431d0 --- /dev/null +++ b/src/TEST.java @@ -0,0 +1,10 @@ +/** + * @author QGW + * @version . + * @Time: + */ +public class TEST { + public static void main(String[] args) { + + } +} diff --git a/src/TankWar/gameVer02.java b/src/TankWar/gameVer02.java new file mode 100644 index 0000000..b474a1c --- /dev/null +++ b/src/TankWar/gameVer02.java @@ -0,0 +1,8 @@ +package TankWar; + +public class gameVer02 { + public static void main(String[] args) { + + } +} + diff --git a/src/chapter10/HomeWork2/Frock.java b/src/chapter10/HomeWork2/Frock.java new file mode 100644 index 0000000..e5e7d3b --- /dev/null +++ b/src/chapter10/HomeWork2/Frock.java @@ -0,0 +1,33 @@ +package chapter10.HomeWork2; + +/** + * @author qgw + */ +public class Frock { + + private static int currentNum = 100000; + int serialNumber; + +// public static int getNextNum(int currentNum){ +// return Frock.currentNum = currentNum + 100; +// } + public static int getNextNum(){ + return currentNum = currentNum + 100; + } + public Frock(){ + this.serialNumber = getNextNum(); + } + public int getSerialNumber() { + return serialNumber; + } +} +class TestFrock{ + public static void main(String[] args) { + Frock frock = new Frock(); + System.out.println(frock.getSerialNumber()); + Frock frock1 = new Frock(); + System.out.println(frock1.getSerialNumber()); + Frock frock2 = new Frock(); + System.out.println(frock2.getSerialNumber()); + } +} \ No newline at end of file diff --git a/src/chapter10/HomeWork3/Test1.java b/src/chapter10/HomeWork3/Test1.java new file mode 100644 index 0000000..edcaa78 --- /dev/null +++ b/src/chapter10/HomeWork3/Test1.java @@ -0,0 +1,31 @@ +package chapter10.HomeWork3; + +/** + * @author qgw + */ +public class Test1 { + public static void main(String[] args) { + Animal cat = new Cat(); + cat.shout(); + Animal dog = new Dog(); + dog.shout(); + + + + } +} +abstract class Animal{ + abstract void shout(); +} +class Cat extends Animal{ + @Override + void shout() { + System.out.println("喵喵~"); + } +} +class Dog extends Animal{ + @Override + void shout() { + System.out.println("旺旺"); + } +} diff --git a/src/chapter10/HomeWork4/jisuan.java b/src/chapter10/HomeWork4/jisuan.java new file mode 100644 index 0000000..076dad8 --- /dev/null +++ b/src/chapter10/HomeWork4/jisuan.java @@ -0,0 +1,39 @@ +package chapter10.HomeWork4; + +import java.util.Scanner; + +/** + * @author qgw + */ + +interface arithmetic{ + void work(int a,String c,int b); +} +class Cellphone implements arithmetic { + + public void testWork(Cellphone cellphone){ + } + + + + @Override + public void work(int a, String c, int b){ + int d = 0; + switch (c){ + case "+": d = a + b; + break; + case "-": d = a - b; + break; + case "*": d = a * b; + break; + case "/": d = a / b; + break; + } + System.out.println(d); + } +} +public class jisuan{ + public static void main(String[] args) { + new Cellphone().testWork(new Cellphone(){}); + } +} \ No newline at end of file diff --git a/src/chapter10/HomeWork4/suan.java b/src/chapter10/HomeWork4/suan.java new file mode 100644 index 0000000..fb6814e --- /dev/null +++ b/src/chapter10/HomeWork4/suan.java @@ -0,0 +1,28 @@ +package chapter10.HomeWork4; + +/** + * @author qgw + */ +interface ss{ + public void work(int a,int b); +} +class phone implements ss{ + public void testwork(ss s,int a, int b){ + s.work(1,2); + } + + @Override + public void work(int a,int b) { + + } +} +public class suan { + public static void main(String[] args) { + new phone().testwork(new ss() { + @Override + public void work(int a, int b) { + System.out.println(a + b); + } + },1,2); + } +} diff --git a/src/chapter10/HomeWork6/test.java b/src/chapter10/HomeWork6/test.java new file mode 100644 index 0000000..0103eb9 --- /dev/null +++ b/src/chapter10/HomeWork6/test.java @@ -0,0 +1,54 @@ +package chapter10.HomeWork6; + +import java.util.Arrays; + +/** + * @author qgw + */ +interface Vehicles{ + String Work(); +} +class Horse implements Vehicles{ + @Override + public String Work() { + return "骑马"; + } +} +class Boat implements Vehicles{ + @Override + public String Work() { + return "开船"; + } +} +class tools{ + public String horse(){ + Horse horse = new Horse(); + return horse.Work(); + } + public String boat(){ + Boat boat = new Boat(); + return boat.Work(); + } +} +class Person{ + public String name; + public String Vehicles; + final char ch[] = {'j','a','v','a'}; + + + public Person(String name, String vehicles) { + this.name = name; + this.Vehicles = vehicles; + } +} +public class test { + public static void main(String[] args) { + tools tool = new tools(); + Person person = new Person("唐僧",tool.boat()); +// System.out.println(person.name + person.Vehicles); + System.out.println(person.ch); + int[] arr = {0,1,2,3,4}; + Arrays.stream(arr).max(); + + } +} \ No newline at end of file diff --git a/src/chapter10/Practice.java b/src/chapter10/Practice.java new file mode 100644 index 0000000..62fd395 --- /dev/null +++ b/src/chapter10/Practice.java @@ -0,0 +1,27 @@ +package chapter10; + + +import java.util.Scanner; + +/** + * @author qgw + */ +public class Practice { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + while (true) { + String str = scanner.next(); + try { + int a = Integer.parseInt(str); + System.out.println(a); + break; + } catch (Exception e) { + System.out.println("非整数,重新输入\n"); + System.out.println(""); + } + } + + + } +} diff --git a/src/chapter10/Test1_Static.java b/src/chapter10/Test1_Static.java new file mode 100644 index 0000000..037d256 --- /dev/null +++ b/src/chapter10/Test1_Static.java @@ -0,0 +1,41 @@ +package chapter10; + +import java.util.HashSet; + +class MyException extends RuntimeException { + public MyException() {} + public MyException(String s) { + super(s); + } +} + +public class Test1_Static { + public static void main(String[] args) { +//自定义异常 +// try { +// throw new MyException("自定义异常被执行"); +// } catch (MyException e) { +// System.out.println("出错啦!" + e.getMessage()); +// +// } +// 输入学生平均成绩并输出 +// int total = 0; +// for (int i = 1; i < 4; i++) { +// int sum = 0; +// for (int j = 1; j < 6; j++) { +// System.out.println("请输入第" + i + "个班" + "第" + j + "个学生成绩"); +// Scanner scanner = new Scanner(System.in); +// int i1 = scanner.nextInt(); +// sum += i1; +// } +// System.out.println("第" + i +"班平均成绩=" + sum/5); +// total += sum; +// } +// System.out.println("总平均成绩=" + total/15); + HashSet hashSet = new HashSet(); + hashSet.add("java"); + hashSet.add("php"); + hashSet.add("java"); + System.out.println(hashSet); + } +} \ No newline at end of file diff --git a/src/chapter14/hashmapexe.java b/src/chapter14/hashmapexe.java new file mode 100644 index 0000000..bc2345b --- /dev/null +++ b/src/chapter14/hashmapexe.java @@ -0,0 +1,66 @@ +package chapter14; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class hashmapexe { + public static void main(String[] args) { + Map hashMap = new HashMap(); + hashMap.put(1,new EMP(1,"qgw",20000)); + hashMap.put(2,new EMP(2,"zyl",30000)); + hashMap.put(3,new EMP(3,"zw",10000)); + //迭代器 + Set set = hashMap.keySet(); + System.out.println("迭代器"); + for (Object o :set) { + EMP O = (EMP) hashMap.get(o); + if (O.getSal() > 18000) + System.out.println(o + "-" + hashMap.get(o)); + } + } +} +class EMP{ + private int id; + private String name; + private int sal; + public EMP(){} + public EMP(int id, String name, int sal) { + this.id = id; + this.name = name; + this.sal = sal; + } + + @Override + public String toString() { + return "EMP{" + + "id=" + id + + ", name='" + name + '\'' + + ", sal=" + sal + + '}'; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getSal() { + return sal; + } + + public void setSal(int sal) { + this.sal = sal; + } +} \ No newline at end of file diff --git a/src/com/com/LingQianTon.java b/src/com/com/LingQianTon.java new file mode 100644 index 0000000..7a0bc3e --- /dev/null +++ b/src/com/com/LingQianTon.java @@ -0,0 +1,83 @@ +package com.com; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Scanner; + +public class LingQianTon { + public static void main(String[] args) { + boolean loop = true; + String key; + String details = ""; + double balance = 0; + double money; + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + do { + System.out.println("--------------零钱通---------------"); + System.out.println("\t\t\t1 零钱通明细"); + System.out.println("\t\t\t2 收益入账"); + System.out.println("\t\t\t3 消费"); + System.out.println("\t\t\t4 退 出"); + + Scanner scanner = new Scanner(System.in); + System.out.println("请输入操作(1-4)"); + key = scanner.next(); + switch (key) { + case "1": + System.out.println("-------------零钱通明细--------------"); + System.out.println(details); + break; + case "2": + System.out.println("请输入收入金额"); + money = scanner.nextDouble(); + if (money <= 0){ + System.out.println("输入金额有误,请重新输入"); + continue; + } + balance = balance + money; + details += "收益入账\t+" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; + System.out.println(); + System.out.println("-------------收益明细--------------"); + System.out.println(details); + break; + case "3": + System.out.println("请输入消费金额"); + money = scanner.nextDouble(); + if (money <= 0){ + System.out.println("输入金额有误,请重新输入"); + continue; + } + if (money > balance){ + System.out.println("输入金额大于余额,重新输入"); + continue; + } + balance = balance - money; + System.out.println("请输入消费原因"); + String moneyOut = scanner.next(); + details += moneyOut + "\t-" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; + System.out.println(); + System.out.println("-------------收益明细--------------"); + System.out.println(details); + break; + case "4": + int index = 0; + do { + System.out.println("是否确认退出 y or n"); + String out = scanner.next(); + if (out.equals("y")) { + System.out.println("退出成功"); + loop = false; + index = 1; + break; + }else if (out.equals("n")) { + System.out.println("取消退出"); + index = 1; + } + else + System.out.println("退出失败,请重新选择"); + }while (index == 0); + } + }while (loop); + } +} \ No newline at end of file diff --git a/src/com/com/OOPlqt.java b/src/com/com/OOPlqt.java new file mode 100644 index 0000000..2539b78 --- /dev/null +++ b/src/com/com/OOPlqt.java @@ -0,0 +1,10 @@ +package com.com; + +import java.util.Scanner; + +public class OOPlqt { + public static void main(String[] args) { + new ways().menu(); + + } +} diff --git a/src/com/com/ways.java b/src/com/com/ways.java new file mode 100644 index 0000000..70ef3b4 --- /dev/null +++ b/src/com/com/ways.java @@ -0,0 +1,105 @@ +package com.com; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Scanner; + +public class ways { + boolean loop = true; + String details = ""; + double balance = 0; + double money; + String key =""; + Date date = new Date(); + Scanner scanner =new Scanner(System.in); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + +public void menu() { + do { + System.out.println("--------------零钱通(OOP)---------------"); + System.out.println("\t\t\t1 零钱通明细"); + System.out.println("\t\t\t2 收益入账"); + System.out.println("\t\t\t3 消费"); + System.out.println("\t\t\t4 退 出"); + + Scanner scanner = new Scanner(System.in); + System.out.println("请输入操作(1-4)"); + key = scanner.next(); + switch (key) { + case "1": + this.details(); + break; + case "2": + this.income(); + break; + case "3": + this.outcome(); + break; + case "4": + this.exit(); + break; + } + }while (loop); +} + + private void exit() { + int index = 0; + do { + System.out.println("是否确认退出 y or n"); + String out = scanner.next(); + if (out.equals("y")) { + System.out.println("退出成功"); + loop = false; + index = 1; + break; + }else if (out.equals("n")) { + System.out.println("取消退出"); + index = 1; + } + else { + System.out.println("输入错误,请重新选择"); + } + }while (index == 0); + + } + + private void outcome() { + System.out.println("请输入消费金额"); + money = scanner.nextDouble(); + if (money <= 0) { + System.out.println("输入金额有误,请重新输入"); + return; + } + if (money > balance){ + System.out.println("输入金额大于余额,重新输入"); + return; + } + balance = balance - money; + System.out.println("请输入消费原因"); + String moneyOut = scanner.next(); + details += moneyOut + "\t-" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; + System.out.println(); + System.out.println("-------------收益明细--------------"); + System.out.println(details); + } + + private void income() { + System.out.println("请输入收入金额"); + money = scanner.nextDouble(); + if (money <= 0) { + System.out.println("输入金额有误,请重新输入"); + return; + } + balance = balance + money; + details += "收益入账\t+" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; + System.out.println(); + System.out.println("-------------收益明细--------------"); + System.out.println(details); + } + + private void details() { + System.out.println("-------------零钱通明细--------------"); + System.out.println(details); + + } +} \ No newline at end of file diff --git a/src/com/demo/inner.java b/src/com/demo/inner.java new file mode 100644 index 0000000..49da7b8 --- /dev/null +++ b/src/com/demo/inner.java @@ -0,0 +1,30 @@ +package com.demo; + +interface Bell{ + void ring(); +} +public class inner { + + public static void main(String[] args) { + CellPhone cellPhone = new CellPhone(); + cellPhone.alarm( new Bell() { + @Override + public void ring() { + System.out.println("起床了"); + } + }); + cellPhone.alarm(new Bell() { + @Override + public void ring() { + System.out.println("上课了"); + } + }); + System.out.println("--------------------"); + + } +} +class CellPhone{ + public void alarm(Bell bell){ + bell.ring(); + } +} \ No newline at end of file diff --git a/src/com/demo/out.java b/src/com/demo/out.java new file mode 100644 index 0000000..4818e34 --- /dev/null +++ b/src/com/demo/out.java @@ -0,0 +1,15 @@ +package com.demo; + +public class out { + public static void main(String[] args) { + out out = new out(); + } + public void a(){ + class inner2{ + int a = 1; + } + inner2 inner2 = new inner2(); + System.out.println(inner2.a); + } + +} diff --git a/src/com/demo/www.java b/src/com/demo/www.java new file mode 100644 index 0000000..2ce073b --- /dev/null +++ b/src/com/demo/www.java @@ -0,0 +1,27 @@ +package com.demo; + +/** + * @author qgw + */ +public class www{ + public static void main(String[] args) { + Week[] w = Week.values(); + for (Week i : w){ + System.out.println(i.toString()); + } + } +} +enum Week{ + monday("星期一"),tuesday("星期二"); + private final String name; + + Week(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} + diff --git a/src/com/demo1/ia.java b/src/com/demo1/ia.java new file mode 100644 index 0000000..546b547 --- /dev/null +++ b/src/com/demo1/ia.java @@ -0,0 +1,5 @@ +package com.demo1; + +public interface ia { + +} diff --git a/src/com/extend/father.java b/src/com/extend/father.java new file mode 100644 index 0000000..818595b --- /dev/null +++ b/src/com/extend/father.java @@ -0,0 +1,20 @@ +package com.extend; +public class father extends grandpa{ + public static void main(String[] args) { + father father = new father(); + System.out.println(father.name + "\t" + father.age); + System.out.println(grandpa.name +"\t" + grandpa.age); + } + String name; + int age; + public father(String name,int age){ + super("爷爷",60); + this.name = name; + this.age = age; + System.out.println("子类有参构造器被调用"); + } + public father() { + this("爸爸",18); + System.out.println("子类无参构造器被调用"); + } +} diff --git a/src/com/extend/grandpa.java b/src/com/extend/grandpa.java new file mode 100644 index 0000000..9e93316 --- /dev/null +++ b/src/com/extend/grandpa.java @@ -0,0 +1,17 @@ +package com.extend; + +public class grandpa { + public static int age = 100; + public static String name = "smith"; + + public grandpa() { + this(name,18); + System.out.println("父类无参构造器被调用"); + } + + public grandpa(String name, int age) { + System.out.println("父类有参构造器被调用"); + this.age = age; + this.name = name; + } +} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" new file mode 100644 index 0000000..45e0c84 --- /dev/null +++ "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" @@ -0,0 +1,14 @@ +package com.修饰符.demo; + + +import static com.修饰符.demo.自身.*; + +public class 同包 { + public static void main(String[] args) { + System.out.println(x); + System.out.println(y); + System.out.println(z); + //System.out.println(m); + + } +} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" new file mode 100644 index 0000000..6a62619 --- /dev/null +++ "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" @@ -0,0 +1,15 @@ +package com.修饰符.demo; + +public class 自身{ + public static int x; + protected static int y; + static int z; + private static int m; + + public static void main(String[] args) { + System.out.println(x); + System.out.println(y); + System.out.println(z); + System.out.println(m); + } +} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" new file mode 100644 index 0000000..395379a --- /dev/null +++ "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" @@ -0,0 +1,14 @@ +package com.修饰符.demo1; + +import com.修饰符.demo.自身; + +public class 任意地方{ + public static void main(String[] args) { + 自身 自 = new 自身(); + System.out.println(自身.x); + //System.out.println(y); + //System.out.println(z); + //System.out.println(m); + + } +} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" new file mode 100644 index 0000000..d453d5b --- /dev/null +++ "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" @@ -0,0 +1,14 @@ +package com.修饰符.demo1; + +import com.修饰符.demo.自身; + +public class 继承 extends 自身 { + public static void main(String[] args) { + System.out.println(x); + System.out.println(y); + //System.out.println(z); + //System.out.println(m); + + } + +} diff --git "a/src/com/\346\216\245\345\217\243demo/UseInterface.java" "b/src/com/\346\216\245\345\217\243demo/UseInterface.java" new file mode 100644 index 0000000..8cf34a5 --- /dev/null +++ "b/src/com/\346\216\245\345\217\243demo/UseInterface.java" @@ -0,0 +1,12 @@ +package com.接口demo; + +/** + * @author QGW + * @version . + * @Time: + */ +public class UseInterface implements test { + public static void main(String[] args) { + System.out.println(test.A); + } +} diff --git "a/src/com/\346\216\245\345\217\243demo/test.java" "b/src/com/\346\216\245\345\217\243demo/test.java" new file mode 100644 index 0000000..bd46173 --- /dev/null +++ "b/src/com/\346\216\245\345\217\243demo/test.java" @@ -0,0 +1,5 @@ +package com.接口demo; + +public interface test { + int A = 1; +} diff --git a/src/houseRent/house.java b/src/houseRent/house.java new file mode 100644 index 0000000..14881b2 --- /dev/null +++ b/src/houseRent/house.java @@ -0,0 +1,17 @@ +package houseRent; + +public class house { + String name = null; + String phone = null; + String address = null; + int fee = 0; + String state = null; + + public house(String name, String phone, String address, int fee, String state) { + this.name = name; + this.phone = phone; + this.address = address; + this.fee = fee; + this.state = state; + } +} diff --git a/src/houseRent/houseSys.java b/src/houseRent/houseSys.java new file mode 100644 index 0000000..5a2b47a --- /dev/null +++ b/src/houseRent/houseSys.java @@ -0,0 +1,127 @@ +package houseRent; + +import java.util.Scanner; + +public class houseSys { + + house[] houses = new house[10]; + boolean loop = true; + Scanner scanner = new Scanner(System.in); + int count = 0; + public void menu() { + String key; + do { + System.out.println("--------------房屋出租系统(OOP)---------------"); + System.out.println("\t\t\t1 新 增 房 源"); + System.out.println("\t\t\t2 查 找 房 源"); + System.out.println("\t\t\t3 删 除 房 源"); + System.out.println("\t\t\t4 修改房屋信息"); + System.out.println("\t\t\t5 房 屋 列 表"); + System.out.println("\t\t\t6 退 出"); + + Scanner scanner = new Scanner(System.in); + System.out.println("请输入操作(1-6)"); + key = scanner.next(); + switch (key) { + case "1": + this.addHouse(); + break; + case "2": + int a = scanner.nextInt(); + this.selectHouse(a); + break; + case "3": + int a1 = scanner.nextInt(); + this.deleteHouse(a1); + break; + case "4": + break; + case "5": + this.houseList(); + loop = false; + break; + case "6": + exit(); + break; + default: + } + } while (loop); + } + public void addHouse(){ + + System.out.println("--------------添加房屋---------------"); + System.out.print("姓名: "); + String na = scanner.next(); + System.out.println(); + System.out.print("电话: "); + String ph = scanner.next(); + System.out.println(); + System.out.print("地址: "); + String ad = scanner.next(); + System.out.println(); + System.out.print("月租: "); + int fe = scanner.nextInt(); + System.out.println(); + System.out.print("状态(已出租/未出租): "); + String st = scanner.next(); + houses[count++] =new house(na,ph,ad,fe,st); + System.out.println("--------------添加完成---------------"); + } + public void selectHouse(int choice){ + int index = 0; + + for (int i = 0; i < count; i++) { + if (i == choice) { + System.out.println("--------------------------房屋列表----------------------------"); + System.out.println("编号\t\t房主\t\t电话\t\t地址\t\t月租\t\t状态(未出租/已出租)"); + System.out.println((i + 1) + houses[i].name + houses[i].phone + houses[i].address + houses[i].fee + houses[i].state); + index = 1; + } + if (index != 1) + System.out.println("未找到"); + } + } + public void deleteHouse(int choice){ + int index = 0; + for (int i = 0; i < count; i++) { + if (i == choice) { + houses[i] = null; + index = 1; + System.out.println("删除成功"); + } + if (index != 1) + System.out.println("未找到"); + } + } + public void changeHouse(){ + + } + public void houseList(){ + System.out.println("--------------------------房屋列表----------------------------"); + System.out.println("编号\t\t房主\t\t电话\t\t地址\t\t月租\t\t状态(未出租/已出租)"); + for (int i = 0; i < count; i++) { + System.out.println( (i+1) + houses[i].name + houses[i].phone + houses[i].address + houses[i].fee + houses[i].state); + } + } + public void exit() { + int index = 0; + do { + System.out.println("是否确认退出 y or n"); + String out = scanner.next(); + if (out.equals("y")) { + System.out.println("退出成功"); + loop = false; + index = 1; + break; + }else if (out.equals("n")) { + System.out.println("取消退出"); + index = 1; + } + else { + System.out.println("输入错误,请重新选择"); + } + }while (index == 0); + + } +} + diff --git a/src/houseRent/main.java b/src/houseRent/main.java new file mode 100644 index 0000000..4a785a1 --- /dev/null +++ b/src/houseRent/main.java @@ -0,0 +1,7 @@ +package houseRent; + +public class main { + public static void main(String[] args) { + new houseSys().menu(); + } +} diff --git a/src/preHomeWork/homework/HomeWork1.java b/src/preHomeWork/homework/HomeWork1.java new file mode 100644 index 0000000..06ed475 --- /dev/null +++ b/src/preHomeWork/homework/HomeWork1.java @@ -0,0 +1,100 @@ +package preHomeWork.homework; + +public class HomeWork1 { + public static void main(String[] args) { + Person temp; + int peopleNums = 5; +// Scanner scanner = new Scanner(System.in); +// System.out.println("请输入参与排序人数"); +// peopleNum = scanner.nextInt(); + Person person[] = new Person[peopleNums]; + person[0] = new Person("A",1,"学生"); + person[1] = new Person("B",2,"学生"); + person[2] = new Person("C",3,"学生"); + person[3] = new Person("D",4,"学生"); + person[4] = new Person("E",5,"学生"); +// for (int p = 0; p < person.length; p++) { +// Person P =new Person(); +// System.out.println("请输入名字"); +// String name = scanner.next(); +// P.setName(name); +// System.out.println("请输入年龄"); +// int age = scanner.nextInt(); +// P.setAge(age); +// System.out.println("请输入工作"); +// String job = scanner.next(); +// P.setJob(job); +// person[p] =P; +// } + // 选择排序 O(n2) + /*for (int i = 0; i < person.length - 1; i++) { + for (int j = i + 1; j < person.length; j++) { + if (person[i].age < person[j].age){ + temp = person[i].age; + person[i].age = person[j].age; + person[j].age = temp; + } + } + }*/ + + // 冒泡算法, 找到最小的往后冒 + for (int i = 0; i < person.length - 1; i++) { + for (int j = 0 ; j < person.length - i - 1; j++) { + if (person[j].age < person[j + 1].age){ + temp = person[j]; + person[j]= person[j + 1]; + person[j + 1] = temp; + } + } + } + + for (int i = 0; i < person.length; i++) { + System.out.println(person[i]); + } + } + +} +class Person{ + String name; + int age; + String job; + public Person(){} + public Person(String name, int age, String job) { + this.name = name; + this.age = age; + this.job = job; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getJob() { + return job; + } + + public void setJob(String job) { + this.job = job; + } + + @Override + public String toString() { + return "Person{" + + "name='" + name + '\'' + + ", age=" + age + + ", job='" + job + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/preHomeWork/homework/HomeWork13/Person.java b/src/preHomeWork/homework/HomeWork13/Person.java new file mode 100644 index 0000000..7877e75 --- /dev/null +++ b/src/preHomeWork/homework/HomeWork13/Person.java @@ -0,0 +1,45 @@ +package preHomeWork.homework.HomeWork13; + +public class Person { + private String name; + private char sex; + private int age; + + public Person(String name, char sex, int age) { + this.name = name; + this.sex = sex; + this.age = age; + } + + public Person() { + + } + + public String play(){ + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public char getSex() { + return sex; + } + + public void setSex(char sex) { + this.sex = sex; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } +} diff --git a/src/preHomeWork/homework/HomeWork13/Student.java b/src/preHomeWork/homework/HomeWork13/Student.java new file mode 100644 index 0000000..d0d8de9 --- /dev/null +++ b/src/preHomeWork/homework/HomeWork13/Student.java @@ -0,0 +1,63 @@ +package preHomeWork.homework.HomeWork13; + +public class Student extends Person { + private String name; + private char sex; + private int age; + private String stu_id; + + public Student(String name, char sex, int age, String stu_id) { + this.name = name; + this.sex = sex; + this.age = age; + this.stu_id = stu_id; + } + public String study(){ + return "我会好好学习。"; + } + public String play(){ + return getName() + "爱玩足球"; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "学生的信息:" + + "\nname: " + getName() + + "\nsex: " + getSex() + + "\nage: " + getAge() + + "\nstu_id: " + getStu_id() + + "\n" + play() + '\n'; + } + + public char getSex() { + return sex; + } + + public void setSex(char sex) { + this.sex = sex; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getStu_id() { + return stu_id; + } + + public void setStu_id(String stu_id) { + this.stu_id = stu_id; + } +} diff --git a/src/preHomeWork/homework/HomeWork13/Teacher.java b/src/preHomeWork/homework/HomeWork13/Teacher.java new file mode 100644 index 0000000..5fab7d8 --- /dev/null +++ b/src/preHomeWork/homework/HomeWork13/Teacher.java @@ -0,0 +1,64 @@ +package preHomeWork.homework.HomeWork13; + +public class Teacher extends Person{ + private String name; + private char sex; + private int age; + private int work_age; + + public Teacher(String name, char sex, int age, int work_age) { + this.name = name; + this.sex = sex; + this.age = age; + this.work_age = work_age; + } + public String teach(){ + return "我会认真教学。"; + } + + + public String toString() { + return "老师的信息" + + "\nname: " + getName() + + "\nsex: " + getSex() + + "\nage: " + getAge() + + "\nwork_age : " + getWork_age() + + "\n" + play() + '\n'; + } + + public String play(){ + return getName() + "爱玩象棋"; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public char getSex() { + return sex; + } + + public void setSex(char sex) { + this.sex = sex; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public int getWork_age() { + return work_age; + } + + public void setWork_age(int work_age) { + this.work_age = work_age; + } +} diff --git a/src/preHomeWork/homework/HomeWork13/main.java b/src/preHomeWork/homework/HomeWork13/main.java new file mode 100644 index 0000000..4265a67 --- /dev/null +++ b/src/preHomeWork/homework/HomeWork13/main.java @@ -0,0 +1,34 @@ +package preHomeWork.homework.HomeWork13; + +public class main { + public static void main(String[] args) { + Person temp; + Person person[] = new Person[4]; + person[0] = new Teacher("zyl",'男',21,1); + person[1] = new Teacher("scx",'男',23,2); + person[2] = new Student("qgw",'男',24,"114514"); + person[3] = new Student("zw",'男',25,"1919810"); + for (int i = 0; i + + + + + \ No newline at end of file diff --git "a/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/modules.xml" "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/modules.xml" new file mode 100644 index 0000000..5f589c9 --- /dev/null +++ "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/vcs.xml" "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/vcs.xml" new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/\345\256\236\344\271\240\346\227\245\345\277\227.iml" "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/\345\256\236\344\271\240\346\227\245\345\277\227.iml" new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ "b/\345\256\236\344\271\240\346\227\245\345\277\227/.idea/\345\256\236\344\271\240\346\227\245\345\277\227.iml" @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file -- Gitee From 08c10148115c3ff04923cdc7ea1538bc9c6bccac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=9D=A8=E9=BE=99?= <2116779924@qq.com> Date: Thu, 7 Sep 2023 14:13:23 +0000 Subject: [PATCH 8/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20src?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Apractice/mathDemo.java | 84 ------------ src/Main.java | 2 - src/TEST.java | 10 -- src/TankWar/gameVer02.java | 8 -- src/chapter10/HomeWork2/Frock.java | 33 ----- src/chapter10/HomeWork3/Test1.java | 31 ----- src/chapter10/HomeWork4/jisuan.java | 39 ------ src/chapter10/HomeWork4/suan.java | 28 ---- src/chapter10/HomeWork6/test.java | 54 -------- src/chapter10/Practice.java | 27 ---- src/chapter10/Test1_Static.java | 41 ------ src/chapter14/hashmapexe.java | 66 --------- src/com/com/LingQianTon.java | 83 ------------ src/com/com/OOPlqt.java | 10 -- src/com/com/ways.java | 105 --------------- src/com/demo/inner.java | 30 ----- src/com/demo/out.java | 15 --- src/com/demo/www.java | 27 ---- src/com/demo1/Test.java | 20 --- src/com/demo1/ia.java | 5 - src/com/extend/father.java | 20 --- src/com/extend/grandpa.java | 17 --- .../demo/\345\220\214\345\214\205.java" | 14 -- .../demo/\350\207\252\350\272\253.java" | 15 --- ...\346\204\217\345\234\260\346\226\271.java" | 14 -- .../demo1/\347\273\247\346\211\277.java" | 14 -- .../UseInterface.java" | 12 -- .../\346\216\245\345\217\243demo/test.java" | 5 - src/houseRent/house.java | 17 --- src/houseRent/houseSys.java | 127 ------------------ src/houseRent/main.java | 7 - src/preHomeWork/homework/HomeWork1.java | 100 -------------- .../homework/HomeWork13/Person.java | 45 ------- .../homework/HomeWork13/Student.java | 63 --------- .../homework/HomeWork13/Teacher.java | 64 --------- src/preHomeWork/homework/HomeWork13/main.java | 34 ----- src/preHomeWork/homework/HomeWork3.java | 85 ------------ src/preHomeWork/homework/HomeWork4.java | 49 ------- 38 files changed, 1420 deletions(-) delete mode 100644 src/Apractice/mathDemo.java delete mode 100644 src/Main.java delete mode 100644 src/TEST.java delete mode 100644 src/TankWar/gameVer02.java delete mode 100644 src/chapter10/HomeWork2/Frock.java delete mode 100644 src/chapter10/HomeWork3/Test1.java delete mode 100644 src/chapter10/HomeWork4/jisuan.java delete mode 100644 src/chapter10/HomeWork4/suan.java delete mode 100644 src/chapter10/HomeWork6/test.java delete mode 100644 src/chapter10/Practice.java delete mode 100644 src/chapter10/Test1_Static.java delete mode 100644 src/chapter14/hashmapexe.java delete mode 100644 src/com/com/LingQianTon.java delete mode 100644 src/com/com/OOPlqt.java delete mode 100644 src/com/com/ways.java delete mode 100644 src/com/demo/inner.java delete mode 100644 src/com/demo/out.java delete mode 100644 src/com/demo/www.java delete mode 100644 src/com/demo1/Test.java delete mode 100644 src/com/demo1/ia.java delete mode 100644 src/com/extend/father.java delete mode 100644 src/com/extend/grandpa.java delete mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" delete mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" delete mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" delete mode 100644 "src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" delete mode 100644 "src/com/\346\216\245\345\217\243demo/UseInterface.java" delete mode 100644 "src/com/\346\216\245\345\217\243demo/test.java" delete mode 100644 src/houseRent/house.java delete mode 100644 src/houseRent/houseSys.java delete mode 100644 src/houseRent/main.java delete mode 100644 src/preHomeWork/homework/HomeWork1.java delete mode 100644 src/preHomeWork/homework/HomeWork13/Person.java delete mode 100644 src/preHomeWork/homework/HomeWork13/Student.java delete mode 100644 src/preHomeWork/homework/HomeWork13/Teacher.java delete mode 100644 src/preHomeWork/homework/HomeWork13/main.java delete mode 100644 src/preHomeWork/homework/HomeWork3.java delete mode 100644 src/preHomeWork/homework/HomeWork4.java diff --git a/src/Apractice/mathDemo.java b/src/Apractice/mathDemo.java deleted file mode 100644 index 5884d20..0000000 --- a/src/Apractice/mathDemo.java +++ /dev/null @@ -1,84 +0,0 @@ -package Apractice; - -/** - * @author QGW - * @version 1.3 - * @Time: - */ -import org.junit.jupiter.api.Test; - -import java.util.Scanner; - -public class mathDemo { - - public static void main(String[] args) { - - System.out.println(jiecheng()); - System.out.println(jiecheng()); - System.out.println(jiecheng1()); - - } - @Test - public void jishu(){ - //1到100之间所有奇数的平方和 - int sum = 0; - for (int i = 1; i < 101; i++) { - if (i % 2 != 0){ - sum = sum + i * i; - System.out.println(i + " " + sum); - } - } - } - @Test - public void printzhi() { - //第一个质数起,列出100个质数(十行十列) - boolean isFlag = true; - int count = 0; - for (int i = 2;; i++) { - for (int j = 2; j < i; j++) { - if (i % j == 0) { - isFlag = false; - break; - } - } - - if (isFlag) { - System.out.print(i + " "); - count++; - //满⑩换行 - if (count % 10 == 0) - System.out.println(); - } - - // 重置isFlag - isFlag = true; - - //输出100个退出循环 - if (count == 100) - break; - } - } - - //定义函数,求取正整数N的阶乘 - public static int jiecheng(){ - System.out.println("输入正整数"); - Scanner scanner = new Scanner(System.in); - int N = scanner.nextInt(); - int s = 1; - for (int i = N; i >= 1 ; i--) { - s *= i; - } - return s; - } - - //调用函数求取正整数9的阶乘 - public static int jiecheng1(){ - int s = 1; - for (int i = 9; i >= 1 ; i--) { - s *= i; - } - return s; - } -} - - diff --git a/src/Main.java b/src/Main.java deleted file mode 100644 index 7046417..0000000 --- a/src/Main.java +++ /dev/null @@ -1,2 +0,0 @@ -public class Main { -} diff --git a/src/TEST.java b/src/TEST.java deleted file mode 100644 index e7431d0..0000000 --- a/src/TEST.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @author QGW - * @version . - * @Time: - */ -public class TEST { - public static void main(String[] args) { - - } -} diff --git a/src/TankWar/gameVer02.java b/src/TankWar/gameVer02.java deleted file mode 100644 index b474a1c..0000000 --- a/src/TankWar/gameVer02.java +++ /dev/null @@ -1,8 +0,0 @@ -package TankWar; - -public class gameVer02 { - public static void main(String[] args) { - - } -} - diff --git a/src/chapter10/HomeWork2/Frock.java b/src/chapter10/HomeWork2/Frock.java deleted file mode 100644 index e5e7d3b..0000000 --- a/src/chapter10/HomeWork2/Frock.java +++ /dev/null @@ -1,33 +0,0 @@ -package chapter10.HomeWork2; - -/** - * @author qgw - */ -public class Frock { - - private static int currentNum = 100000; - int serialNumber; - -// public static int getNextNum(int currentNum){ -// return Frock.currentNum = currentNum + 100; -// } - public static int getNextNum(){ - return currentNum = currentNum + 100; - } - public Frock(){ - this.serialNumber = getNextNum(); - } - public int getSerialNumber() { - return serialNumber; - } -} -class TestFrock{ - public static void main(String[] args) { - Frock frock = new Frock(); - System.out.println(frock.getSerialNumber()); - Frock frock1 = new Frock(); - System.out.println(frock1.getSerialNumber()); - Frock frock2 = new Frock(); - System.out.println(frock2.getSerialNumber()); - } -} \ No newline at end of file diff --git a/src/chapter10/HomeWork3/Test1.java b/src/chapter10/HomeWork3/Test1.java deleted file mode 100644 index edcaa78..0000000 --- a/src/chapter10/HomeWork3/Test1.java +++ /dev/null @@ -1,31 +0,0 @@ -package chapter10.HomeWork3; - -/** - * @author qgw - */ -public class Test1 { - public static void main(String[] args) { - Animal cat = new Cat(); - cat.shout(); - Animal dog = new Dog(); - dog.shout(); - - - - } -} -abstract class Animal{ - abstract void shout(); -} -class Cat extends Animal{ - @Override - void shout() { - System.out.println("喵喵~"); - } -} -class Dog extends Animal{ - @Override - void shout() { - System.out.println("旺旺"); - } -} diff --git a/src/chapter10/HomeWork4/jisuan.java b/src/chapter10/HomeWork4/jisuan.java deleted file mode 100644 index 076dad8..0000000 --- a/src/chapter10/HomeWork4/jisuan.java +++ /dev/null @@ -1,39 +0,0 @@ -package chapter10.HomeWork4; - -import java.util.Scanner; - -/** - * @author qgw - */ - -interface arithmetic{ - void work(int a,String c,int b); -} -class Cellphone implements arithmetic { - - public void testWork(Cellphone cellphone){ - } - - - - @Override - public void work(int a, String c, int b){ - int d = 0; - switch (c){ - case "+": d = a + b; - break; - case "-": d = a - b; - break; - case "*": d = a * b; - break; - case "/": d = a / b; - break; - } - System.out.println(d); - } -} -public class jisuan{ - public static void main(String[] args) { - new Cellphone().testWork(new Cellphone(){}); - } -} \ No newline at end of file diff --git a/src/chapter10/HomeWork4/suan.java b/src/chapter10/HomeWork4/suan.java deleted file mode 100644 index fb6814e..0000000 --- a/src/chapter10/HomeWork4/suan.java +++ /dev/null @@ -1,28 +0,0 @@ -package chapter10.HomeWork4; - -/** - * @author qgw - */ -interface ss{ - public void work(int a,int b); -} -class phone implements ss{ - public void testwork(ss s,int a, int b){ - s.work(1,2); - } - - @Override - public void work(int a,int b) { - - } -} -public class suan { - public static void main(String[] args) { - new phone().testwork(new ss() { - @Override - public void work(int a, int b) { - System.out.println(a + b); - } - },1,2); - } -} diff --git a/src/chapter10/HomeWork6/test.java b/src/chapter10/HomeWork6/test.java deleted file mode 100644 index 0103eb9..0000000 --- a/src/chapter10/HomeWork6/test.java +++ /dev/null @@ -1,54 +0,0 @@ -package chapter10.HomeWork6; - -import java.util.Arrays; - -/** - * @author qgw - */ -interface Vehicles{ - String Work(); -} -class Horse implements Vehicles{ - @Override - public String Work() { - return "骑马"; - } -} -class Boat implements Vehicles{ - @Override - public String Work() { - return "开船"; - } -} -class tools{ - public String horse(){ - Horse horse = new Horse(); - return horse.Work(); - } - public String boat(){ - Boat boat = new Boat(); - return boat.Work(); - } -} -class Person{ - public String name; - public String Vehicles; - final char ch[] = {'j','a','v','a'}; - - - public Person(String name, String vehicles) { - this.name = name; - this.Vehicles = vehicles; - } -} -public class test { - public static void main(String[] args) { - tools tool = new tools(); - Person person = new Person("唐僧",tool.boat()); -// System.out.println(person.name + person.Vehicles); - System.out.println(person.ch); - int[] arr = {0,1,2,3,4}; - Arrays.stream(arr).max(); - - } -} \ No newline at end of file diff --git a/src/chapter10/Practice.java b/src/chapter10/Practice.java deleted file mode 100644 index 62fd395..0000000 --- a/src/chapter10/Practice.java +++ /dev/null @@ -1,27 +0,0 @@ -package chapter10; - - -import java.util.Scanner; - -/** - * @author qgw - */ -public class Practice { - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); - - while (true) { - String str = scanner.next(); - try { - int a = Integer.parseInt(str); - System.out.println(a); - break; - } catch (Exception e) { - System.out.println("非整数,重新输入\n"); - System.out.println(""); - } - } - - - } -} diff --git a/src/chapter10/Test1_Static.java b/src/chapter10/Test1_Static.java deleted file mode 100644 index 037d256..0000000 --- a/src/chapter10/Test1_Static.java +++ /dev/null @@ -1,41 +0,0 @@ -package chapter10; - -import java.util.HashSet; - -class MyException extends RuntimeException { - public MyException() {} - public MyException(String s) { - super(s); - } -} - -public class Test1_Static { - public static void main(String[] args) { -//自定义异常 -// try { -// throw new MyException("自定义异常被执行"); -// } catch (MyException e) { -// System.out.println("出错啦!" + e.getMessage()); -// -// } -// 输入学生平均成绩并输出 -// int total = 0; -// for (int i = 1; i < 4; i++) { -// int sum = 0; -// for (int j = 1; j < 6; j++) { -// System.out.println("请输入第" + i + "个班" + "第" + j + "个学生成绩"); -// Scanner scanner = new Scanner(System.in); -// int i1 = scanner.nextInt(); -// sum += i1; -// } -// System.out.println("第" + i +"班平均成绩=" + sum/5); -// total += sum; -// } -// System.out.println("总平均成绩=" + total/15); - HashSet hashSet = new HashSet(); - hashSet.add("java"); - hashSet.add("php"); - hashSet.add("java"); - System.out.println(hashSet); - } -} \ No newline at end of file diff --git a/src/chapter14/hashmapexe.java b/src/chapter14/hashmapexe.java deleted file mode 100644 index bc2345b..0000000 --- a/src/chapter14/hashmapexe.java +++ /dev/null @@ -1,66 +0,0 @@ -package chapter14; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class hashmapexe { - public static void main(String[] args) { - Map hashMap = new HashMap(); - hashMap.put(1,new EMP(1,"qgw",20000)); - hashMap.put(2,new EMP(2,"zyl",30000)); - hashMap.put(3,new EMP(3,"zw",10000)); - //迭代器 - Set set = hashMap.keySet(); - System.out.println("迭代器"); - for (Object o :set) { - EMP O = (EMP) hashMap.get(o); - if (O.getSal() > 18000) - System.out.println(o + "-" + hashMap.get(o)); - } - } -} -class EMP{ - private int id; - private String name; - private int sal; - public EMP(){} - public EMP(int id, String name, int sal) { - this.id = id; - this.name = name; - this.sal = sal; - } - - @Override - public String toString() { - return "EMP{" + - "id=" + id + - ", name='" + name + '\'' + - ", sal=" + sal + - '}'; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getSal() { - return sal; - } - - public void setSal(int sal) { - this.sal = sal; - } -} \ No newline at end of file diff --git a/src/com/com/LingQianTon.java b/src/com/com/LingQianTon.java deleted file mode 100644 index 7a0bc3e..0000000 --- a/src/com/com/LingQianTon.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.com; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Scanner; - -public class LingQianTon { - public static void main(String[] args) { - boolean loop = true; - String key; - String details = ""; - double balance = 0; - double money; - Date date = new Date(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - do { - System.out.println("--------------零钱通---------------"); - System.out.println("\t\t\t1 零钱通明细"); - System.out.println("\t\t\t2 收益入账"); - System.out.println("\t\t\t3 消费"); - System.out.println("\t\t\t4 退 出"); - - Scanner scanner = new Scanner(System.in); - System.out.println("请输入操作(1-4)"); - key = scanner.next(); - switch (key) { - case "1": - System.out.println("-------------零钱通明细--------------"); - System.out.println(details); - break; - case "2": - System.out.println("请输入收入金额"); - money = scanner.nextDouble(); - if (money <= 0){ - System.out.println("输入金额有误,请重新输入"); - continue; - } - balance = balance + money; - details += "收益入账\t+" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; - System.out.println(); - System.out.println("-------------收益明细--------------"); - System.out.println(details); - break; - case "3": - System.out.println("请输入消费金额"); - money = scanner.nextDouble(); - if (money <= 0){ - System.out.println("输入金额有误,请重新输入"); - continue; - } - if (money > balance){ - System.out.println("输入金额大于余额,重新输入"); - continue; - } - balance = balance - money; - System.out.println("请输入消费原因"); - String moneyOut = scanner.next(); - details += moneyOut + "\t-" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; - System.out.println(); - System.out.println("-------------收益明细--------------"); - System.out.println(details); - break; - case "4": - int index = 0; - do { - System.out.println("是否确认退出 y or n"); - String out = scanner.next(); - if (out.equals("y")) { - System.out.println("退出成功"); - loop = false; - index = 1; - break; - }else if (out.equals("n")) { - System.out.println("取消退出"); - index = 1; - } - else - System.out.println("退出失败,请重新选择"); - }while (index == 0); - } - }while (loop); - } -} \ No newline at end of file diff --git a/src/com/com/OOPlqt.java b/src/com/com/OOPlqt.java deleted file mode 100644 index 2539b78..0000000 --- a/src/com/com/OOPlqt.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.com; - -import java.util.Scanner; - -public class OOPlqt { - public static void main(String[] args) { - new ways().menu(); - - } -} diff --git a/src/com/com/ways.java b/src/com/com/ways.java deleted file mode 100644 index 70ef3b4..0000000 --- a/src/com/com/ways.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.com; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Scanner; - -public class ways { - boolean loop = true; - String details = ""; - double balance = 0; - double money; - String key =""; - Date date = new Date(); - Scanner scanner =new Scanner(System.in); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - -public void menu() { - do { - System.out.println("--------------零钱通(OOP)---------------"); - System.out.println("\t\t\t1 零钱通明细"); - System.out.println("\t\t\t2 收益入账"); - System.out.println("\t\t\t3 消费"); - System.out.println("\t\t\t4 退 出"); - - Scanner scanner = new Scanner(System.in); - System.out.println("请输入操作(1-4)"); - key = scanner.next(); - switch (key) { - case "1": - this.details(); - break; - case "2": - this.income(); - break; - case "3": - this.outcome(); - break; - case "4": - this.exit(); - break; - } - }while (loop); -} - - private void exit() { - int index = 0; - do { - System.out.println("是否确认退出 y or n"); - String out = scanner.next(); - if (out.equals("y")) { - System.out.println("退出成功"); - loop = false; - index = 1; - break; - }else if (out.equals("n")) { - System.out.println("取消退出"); - index = 1; - } - else { - System.out.println("输入错误,请重新选择"); - } - }while (index == 0); - - } - - private void outcome() { - System.out.println("请输入消费金额"); - money = scanner.nextDouble(); - if (money <= 0) { - System.out.println("输入金额有误,请重新输入"); - return; - } - if (money > balance){ - System.out.println("输入金额大于余额,重新输入"); - return; - } - balance = balance - money; - System.out.println("请输入消费原因"); - String moneyOut = scanner.next(); - details += moneyOut + "\t-" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; - System.out.println(); - System.out.println("-------------收益明细--------------"); - System.out.println(details); - } - - private void income() { - System.out.println("请输入收入金额"); - money = scanner.nextDouble(); - if (money <= 0) { - System.out.println("输入金额有误,请重新输入"); - return; - } - balance = balance + money; - details += "收益入账\t+" + money + "\t" + sdf.format(date) + "\t" + balance + "\n"; - System.out.println(); - System.out.println("-------------收益明细--------------"); - System.out.println(details); - } - - private void details() { - System.out.println("-------------零钱通明细--------------"); - System.out.println(details); - - } -} \ No newline at end of file diff --git a/src/com/demo/inner.java b/src/com/demo/inner.java deleted file mode 100644 index 49da7b8..0000000 --- a/src/com/demo/inner.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.demo; - -interface Bell{ - void ring(); -} -public class inner { - - public static void main(String[] args) { - CellPhone cellPhone = new CellPhone(); - cellPhone.alarm( new Bell() { - @Override - public void ring() { - System.out.println("起床了"); - } - }); - cellPhone.alarm(new Bell() { - @Override - public void ring() { - System.out.println("上课了"); - } - }); - System.out.println("--------------------"); - - } -} -class CellPhone{ - public void alarm(Bell bell){ - bell.ring(); - } -} \ No newline at end of file diff --git a/src/com/demo/out.java b/src/com/demo/out.java deleted file mode 100644 index 4818e34..0000000 --- a/src/com/demo/out.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.demo; - -public class out { - public static void main(String[] args) { - out out = new out(); - } - public void a(){ - class inner2{ - int a = 1; - } - inner2 inner2 = new inner2(); - System.out.println(inner2.a); - } - -} diff --git a/src/com/demo/www.java b/src/com/demo/www.java deleted file mode 100644 index 2ce073b..0000000 --- a/src/com/demo/www.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.demo; - -/** - * @author qgw - */ -public class www{ - public static void main(String[] args) { - Week[] w = Week.values(); - for (Week i : w){ - System.out.println(i.toString()); - } - } -} -enum Week{ - monday("星期一"),tuesday("星期二"); - private final String name; - - Week(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} - diff --git a/src/com/demo1/Test.java b/src/com/demo1/Test.java deleted file mode 100644 index bc2d14c..0000000 --- a/src/com/demo1/Test.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.demo1; - -public class Test { - public Test() { - Inner inner = new Inner(); - inner.a = 10; - System.out.println(inner.a); - Inner inner1 = new Inner(); - System.out.println(inner1.a); - } - class Inner{ - public int a = 1; - } - - public static void main(String[] args) { - Test test = new Test(); - Inner R = test.new Inner(); - System.out.println(R.a); - } -} diff --git a/src/com/demo1/ia.java b/src/com/demo1/ia.java deleted file mode 100644 index 546b547..0000000 --- a/src/com/demo1/ia.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.demo1; - -public interface ia { - -} diff --git a/src/com/extend/father.java b/src/com/extend/father.java deleted file mode 100644 index 818595b..0000000 --- a/src/com/extend/father.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.extend; -public class father extends grandpa{ - public static void main(String[] args) { - father father = new father(); - System.out.println(father.name + "\t" + father.age); - System.out.println(grandpa.name +"\t" + grandpa.age); - } - String name; - int age; - public father(String name,int age){ - super("爷爷",60); - this.name = name; - this.age = age; - System.out.println("子类有参构造器被调用"); - } - public father() { - this("爸爸",18); - System.out.println("子类无参构造器被调用"); - } -} diff --git a/src/com/extend/grandpa.java b/src/com/extend/grandpa.java deleted file mode 100644 index 9e93316..0000000 --- a/src/com/extend/grandpa.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.extend; - -public class grandpa { - public static int age = 100; - public static String name = "smith"; - - public grandpa() { - this(name,18); - System.out.println("父类无参构造器被调用"); - } - - public grandpa(String name, int age) { - System.out.println("父类有参构造器被调用"); - this.age = age; - this.name = name; - } -} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" deleted file mode 100644 index 45e0c84..0000000 --- "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\345\220\214\345\214\205.java" +++ /dev/null @@ -1,14 +0,0 @@ -package com.修饰符.demo; - - -import static com.修饰符.demo.自身.*; - -public class 同包 { - public static void main(String[] args) { - System.out.println(x); - System.out.println(y); - System.out.println(z); - //System.out.println(m); - - } -} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" deleted file mode 100644 index 6a62619..0000000 --- "a/src/com/\344\277\256\351\245\260\347\254\246/demo/\350\207\252\350\272\253.java" +++ /dev/null @@ -1,15 +0,0 @@ -package com.修饰符.demo; - -public class 自身{ - public static int x; - protected static int y; - static int z; - private static int m; - - public static void main(String[] args) { - System.out.println(x); - System.out.println(y); - System.out.println(z); - System.out.println(m); - } -} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" deleted file mode 100644 index 395379a..0000000 --- "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\344\273\273\346\204\217\345\234\260\346\226\271.java" +++ /dev/null @@ -1,14 +0,0 @@ -package com.修饰符.demo1; - -import com.修饰符.demo.自身; - -public class 任意地方{ - public static void main(String[] args) { - 自身 自 = new 自身(); - System.out.println(自身.x); - //System.out.println(y); - //System.out.println(z); - //System.out.println(m); - - } -} diff --git "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" "b/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" deleted file mode 100644 index d453d5b..0000000 --- "a/src/com/\344\277\256\351\245\260\347\254\246/demo1/\347\273\247\346\211\277.java" +++ /dev/null @@ -1,14 +0,0 @@ -package com.修饰符.demo1; - -import com.修饰符.demo.自身; - -public class 继承 extends 自身 { - public static void main(String[] args) { - System.out.println(x); - System.out.println(y); - //System.out.println(z); - //System.out.println(m); - - } - -} diff --git "a/src/com/\346\216\245\345\217\243demo/UseInterface.java" "b/src/com/\346\216\245\345\217\243demo/UseInterface.java" deleted file mode 100644 index 8cf34a5..0000000 --- "a/src/com/\346\216\245\345\217\243demo/UseInterface.java" +++ /dev/null @@ -1,12 +0,0 @@ -package com.接口demo; - -/** - * @author QGW - * @version . - * @Time: - */ -public class UseInterface implements test { - public static void main(String[] args) { - System.out.println(test.A); - } -} diff --git "a/src/com/\346\216\245\345\217\243demo/test.java" "b/src/com/\346\216\245\345\217\243demo/test.java" deleted file mode 100644 index bd46173..0000000 --- "a/src/com/\346\216\245\345\217\243demo/test.java" +++ /dev/null @@ -1,5 +0,0 @@ -package com.接口demo; - -public interface test { - int A = 1; -} diff --git a/src/houseRent/house.java b/src/houseRent/house.java deleted file mode 100644 index 14881b2..0000000 --- a/src/houseRent/house.java +++ /dev/null @@ -1,17 +0,0 @@ -package houseRent; - -public class house { - String name = null; - String phone = null; - String address = null; - int fee = 0; - String state = null; - - public house(String name, String phone, String address, int fee, String state) { - this.name = name; - this.phone = phone; - this.address = address; - this.fee = fee; - this.state = state; - } -} diff --git a/src/houseRent/houseSys.java b/src/houseRent/houseSys.java deleted file mode 100644 index 5a2b47a..0000000 --- a/src/houseRent/houseSys.java +++ /dev/null @@ -1,127 +0,0 @@ -package houseRent; - -import java.util.Scanner; - -public class houseSys { - - house[] houses = new house[10]; - boolean loop = true; - Scanner scanner = new Scanner(System.in); - int count = 0; - public void menu() { - String key; - do { - System.out.println("--------------房屋出租系统(OOP)---------------"); - System.out.println("\t\t\t1 新 增 房 源"); - System.out.println("\t\t\t2 查 找 房 源"); - System.out.println("\t\t\t3 删 除 房 源"); - System.out.println("\t\t\t4 修改房屋信息"); - System.out.println("\t\t\t5 房 屋 列 表"); - System.out.println("\t\t\t6 退 出"); - - Scanner scanner = new Scanner(System.in); - System.out.println("请输入操作(1-6)"); - key = scanner.next(); - switch (key) { - case "1": - this.addHouse(); - break; - case "2": - int a = scanner.nextInt(); - this.selectHouse(a); - break; - case "3": - int a1 = scanner.nextInt(); - this.deleteHouse(a1); - break; - case "4": - break; - case "5": - this.houseList(); - loop = false; - break; - case "6": - exit(); - break; - default: - } - } while (loop); - } - public void addHouse(){ - - System.out.println("--------------添加房屋---------------"); - System.out.print("姓名: "); - String na = scanner.next(); - System.out.println(); - System.out.print("电话: "); - String ph = scanner.next(); - System.out.println(); - System.out.print("地址: "); - String ad = scanner.next(); - System.out.println(); - System.out.print("月租: "); - int fe = scanner.nextInt(); - System.out.println(); - System.out.print("状态(已出租/未出租): "); - String st = scanner.next(); - houses[count++] =new house(na,ph,ad,fe,st); - System.out.println("--------------添加完成---------------"); - } - public void selectHouse(int choice){ - int index = 0; - - for (int i = 0; i < count; i++) { - if (i == choice) { - System.out.println("--------------------------房屋列表----------------------------"); - System.out.println("编号\t\t房主\t\t电话\t\t地址\t\t月租\t\t状态(未出租/已出租)"); - System.out.println((i + 1) + houses[i].name + houses[i].phone + houses[i].address + houses[i].fee + houses[i].state); - index = 1; - } - if (index != 1) - System.out.println("未找到"); - } - } - public void deleteHouse(int choice){ - int index = 0; - for (int i = 0; i < count; i++) { - if (i == choice) { - houses[i] = null; - index = 1; - System.out.println("删除成功"); - } - if (index != 1) - System.out.println("未找到"); - } - } - public void changeHouse(){ - - } - public void houseList(){ - System.out.println("--------------------------房屋列表----------------------------"); - System.out.println("编号\t\t房主\t\t电话\t\t地址\t\t月租\t\t状态(未出租/已出租)"); - for (int i = 0; i < count; i++) { - System.out.println( (i+1) + houses[i].name + houses[i].phone + houses[i].address + houses[i].fee + houses[i].state); - } - } - public void exit() { - int index = 0; - do { - System.out.println("是否确认退出 y or n"); - String out = scanner.next(); - if (out.equals("y")) { - System.out.println("退出成功"); - loop = false; - index = 1; - break; - }else if (out.equals("n")) { - System.out.println("取消退出"); - index = 1; - } - else { - System.out.println("输入错误,请重新选择"); - } - }while (index == 0); - - } -} - diff --git a/src/houseRent/main.java b/src/houseRent/main.java deleted file mode 100644 index 4a785a1..0000000 --- a/src/houseRent/main.java +++ /dev/null @@ -1,7 +0,0 @@ -package houseRent; - -public class main { - public static void main(String[] args) { - new houseSys().menu(); - } -} diff --git a/src/preHomeWork/homework/HomeWork1.java b/src/preHomeWork/homework/HomeWork1.java deleted file mode 100644 index 06ed475..0000000 --- a/src/preHomeWork/homework/HomeWork1.java +++ /dev/null @@ -1,100 +0,0 @@ -package preHomeWork.homework; - -public class HomeWork1 { - public static void main(String[] args) { - Person temp; - int peopleNums = 5; -// Scanner scanner = new Scanner(System.in); -// System.out.println("请输入参与排序人数"); -// peopleNum = scanner.nextInt(); - Person person[] = new Person[peopleNums]; - person[0] = new Person("A",1,"学生"); - person[1] = new Person("B",2,"学生"); - person[2] = new Person("C",3,"学生"); - person[3] = new Person("D",4,"学生"); - person[4] = new Person("E",5,"学生"); -// for (int p = 0; p < person.length; p++) { -// Person P =new Person(); -// System.out.println("请输入名字"); -// String name = scanner.next(); -// P.setName(name); -// System.out.println("请输入年龄"); -// int age = scanner.nextInt(); -// P.setAge(age); -// System.out.println("请输入工作"); -// String job = scanner.next(); -// P.setJob(job); -// person[p] =P; -// } - // 选择排序 O(n2) - /*for (int i = 0; i < person.length - 1; i++) { - for (int j = i + 1; j < person.length; j++) { - if (person[i].age < person[j].age){ - temp = person[i].age; - person[i].age = person[j].age; - person[j].age = temp; - } - } - }*/ - - // 冒泡算法, 找到最小的往后冒 - for (int i = 0; i < person.length - 1; i++) { - for (int j = 0 ; j < person.length - i - 1; j++) { - if (person[j].age < person[j + 1].age){ - temp = person[j]; - person[j]= person[j + 1]; - person[j + 1] = temp; - } - } - } - - for (int i = 0; i < person.length; i++) { - System.out.println(person[i]); - } - } - -} -class Person{ - String name; - int age; - String job; - public Person(){} - public Person(String name, int age, String job) { - this.name = name; - this.age = age; - this.job = job; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getJob() { - return job; - } - - public void setJob(String job) { - this.job = job; - } - - @Override - public String toString() { - return "Person{" + - "name='" + name + '\'' + - ", age=" + age + - ", job='" + job + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/src/preHomeWork/homework/HomeWork13/Person.java b/src/preHomeWork/homework/HomeWork13/Person.java deleted file mode 100644 index 7877e75..0000000 --- a/src/preHomeWork/homework/HomeWork13/Person.java +++ /dev/null @@ -1,45 +0,0 @@ -package preHomeWork.homework.HomeWork13; - -public class Person { - private String name; - private char sex; - private int age; - - public Person(String name, char sex, int age) { - this.name = name; - this.sex = sex; - this.age = age; - } - - public Person() { - - } - - public String play(){ - return null; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public char getSex() { - return sex; - } - - public void setSex(char sex) { - this.sex = sex; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } -} diff --git a/src/preHomeWork/homework/HomeWork13/Student.java b/src/preHomeWork/homework/HomeWork13/Student.java deleted file mode 100644 index d0d8de9..0000000 --- a/src/preHomeWork/homework/HomeWork13/Student.java +++ /dev/null @@ -1,63 +0,0 @@ -package preHomeWork.homework.HomeWork13; - -public class Student extends Person { - private String name; - private char sex; - private int age; - private String stu_id; - - public Student(String name, char sex, int age, String stu_id) { - this.name = name; - this.sex = sex; - this.age = age; - this.stu_id = stu_id; - } - public String study(){ - return "我会好好学习。"; - } - public String play(){ - return getName() + "爱玩足球"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return "学生的信息:" + - "\nname: " + getName() + - "\nsex: " + getSex() + - "\nage: " + getAge() + - "\nstu_id: " + getStu_id() + - "\n" + play() + '\n'; - } - - public char getSex() { - return sex; - } - - public void setSex(char sex) { - this.sex = sex; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getStu_id() { - return stu_id; - } - - public void setStu_id(String stu_id) { - this.stu_id = stu_id; - } -} diff --git a/src/preHomeWork/homework/HomeWork13/Teacher.java b/src/preHomeWork/homework/HomeWork13/Teacher.java deleted file mode 100644 index 5fab7d8..0000000 --- a/src/preHomeWork/homework/HomeWork13/Teacher.java +++ /dev/null @@ -1,64 +0,0 @@ -package preHomeWork.homework.HomeWork13; - -public class Teacher extends Person{ - private String name; - private char sex; - private int age; - private int work_age; - - public Teacher(String name, char sex, int age, int work_age) { - this.name = name; - this.sex = sex; - this.age = age; - this.work_age = work_age; - } - public String teach(){ - return "我会认真教学。"; - } - - - public String toString() { - return "老师的信息" + - "\nname: " + getName() + - "\nsex: " + getSex() + - "\nage: " + getAge() + - "\nwork_age : " + getWork_age() + - "\n" + play() + '\n'; - } - - public String play(){ - return getName() + "爱玩象棋"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public char getSex() { - return sex; - } - - public void setSex(char sex) { - this.sex = sex; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public int getWork_age() { - return work_age; - } - - public void setWork_age(int work_age) { - this.work_age = work_age; - } -} diff --git a/src/preHomeWork/homework/HomeWork13/main.java b/src/preHomeWork/homework/HomeWork13/main.java deleted file mode 100644 index 4265a67..0000000 --- a/src/preHomeWork/homework/HomeWork13/main.java +++ /dev/null @@ -1,34 +0,0 @@ -package preHomeWork.homework.HomeWork13; - -public class main { - public static void main(String[] args) { - Person temp; - Person person[] = new Person[4]; - person[0] = new Teacher("zyl",'男',21,1); - person[1] = new Teacher("scx",'男',23,2); - person[2] = new Student("qgw",'男',24,"114514"); - person[3] = new Student("zw",'男',25,"1919810"); - for (int i = 0; i Date: Thu, 7 Sep 2023 14:13:35 +0000 Subject: [PATCH 9/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20qgw.?= =?UTF-8?q?iml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qgw.iml | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 qgw.iml diff --git a/qgw.iml b/qgw.iml deleted file mode 100644 index 75bd9a6..0000000 --- a/qgw.iml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- Gitee