From 7c7931e8a79e2fc8080fbf2c96d5ff26779ec5bb Mon Sep 17 00:00:00 2001 From: Administrator <2463860418@qq.com> Date: Thu, 9 May 2024 10:27:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=EF=BC=9A=E6=8F=90=E4=BA=A4=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../One.java" | 120 ++++++++++++++++++ .../Two.java" | 21 +++ 2 files changed, 141 insertions(+) create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/Two.java" diff --git "a/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" "b/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" new file mode 100644 index 0000000..29c47d7 --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" @@ -0,0 +1,120 @@ +package com.java.minxi.java_20240508.java_2302_程斌_2344310223; + +public class One { + // 定义交通工具类 + static class Vehicles { + private String type; + public String brand; + public String color; + public String place; + + + public Vehicles() { + } + + public Vehicles(String type, String brand, String color, String place) { + this.type = type; + this.brand = brand; + this.color = color; + this.place = place; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getPlace() { + return place; + } + + public void setPlace(String place) { + this.place = place; + } + + + public void travel() { + System.out.println("开着" + color + brand + type + "前往" + place + "旅游"); + } + } + + // 汽车类 + static class Car extends Vehicles { + public Car() { + super.setType("汽车"); + } + + public Car(String brand, String color, String place) { + super.setType("汽车"); + super.setBrand(brand); + super.setColor(color); + super.setPlace(place); + } + + + @Override + public void travel() { + System.out.println("开着" + color + brand + "汽车前往" + place + "旅游"); + } + + + public String combination(String color, String brand) { + return color + brand; + } + + + public String combination(String brand) { + return brand; + } + } + + // 飞机类 + static class AirPlane extends Vehicles { + public AirPlane() { + super.setType("飞机"); + } + + public AirPlane(String brand, String color, String place) { + super.setType("飞机"); + super.setBrand(brand); + super.setColor(color); + super.setPlace(place); + } + + + @Override + public void travel() { + System.out.println("坐着" + color + brand + "客机前往" + place + "旅游"); + } + + + public String combination(String color, String brand) { + return color + brand; + } + + + public String combination(String brand) { + return brand; + } + } + +} diff --git "a/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/Two.java" "b/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/Two.java" new file mode 100644 index 0000000..27f90cf --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/Two.java" @@ -0,0 +1,21 @@ +package com.java.minxi.java_20240508.java_2302_程斌_2344310223; + +public class Two { + public static void main(String[] args) { + //开着白色大众汽车前往北京旅游 + One.Car car1 = new One.Car("大众", "白色", "北京"); + car1.travel(); + + //开着奔驰汽车前往东山岛旅游 + One.Car car2 = new One.Car("奔驰", "无颜色", "东山岛"); + car2.travel(); + + //坐着蓝色波音客机前往大理旅游 + One.AirPlane airplane1 = new One.AirPlane("波音", "蓝色", "大理"); + airplane1.travel(); + + //坐着空客客机前往哈尔滨岛旅游 + One.AirPlane airplane2 = new One.AirPlane("空客", "无颜色", "哈尔滨岛"); + airplane2.travel(); + } +} -- Gitee From 09b0e33b35cd7eba11282f1299eca946a0a5b352 Mon Sep 17 00:00:00 2001 From: Administrator <402475095@qq.com> Date: Thu, 9 May 2024 10:39:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat=EF=BC=9A=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../One.java" | 120 ------------------ .../AirPlane.java" | 18 +++ .../Car.java" | 28 ++++ .../Main.java" | 41 ++++++ .../Vehicles.java" | 67 ++++++++++ 5 files changed, 154 insertions(+), 120 deletions(-) delete mode 100644 "work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/AirPlane.java" create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Car.java" create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Main.java" create mode 100644 "work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Vehicles.java" diff --git "a/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" "b/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" deleted file mode 100644 index 29c47d7..0000000 --- "a/work/com/java/minxi/java_20240508/java_2302_\347\250\213\346\226\214_2344310223/One.java" +++ /dev/null @@ -1,120 +0,0 @@ -package com.java.minxi.java_20240508.java_2302_程斌_2344310223; - -public class One { - // 定义交通工具类 - static class Vehicles { - private String type; - public String brand; - public String color; - public String place; - - - public Vehicles() { - } - - public Vehicles(String type, String brand, String color, String place) { - this.type = type; - this.brand = brand; - this.color = color; - this.place = place; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getBrand() { - return brand; - } - - public void setBrand(String brand) { - this.brand = brand; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public String getPlace() { - return place; - } - - public void setPlace(String place) { - this.place = place; - } - - - public void travel() { - System.out.println("开着" + color + brand + type + "前往" + place + "旅游"); - } - } - - // 汽车类 - static class Car extends Vehicles { - public Car() { - super.setType("汽车"); - } - - public Car(String brand, String color, String place) { - super.setType("汽车"); - super.setBrand(brand); - super.setColor(color); - super.setPlace(place); - } - - - @Override - public void travel() { - System.out.println("开着" + color + brand + "汽车前往" + place + "旅游"); - } - - - public String combination(String color, String brand) { - return color + brand; - } - - - public String combination(String brand) { - return brand; - } - } - - // 飞机类 - static class AirPlane extends Vehicles { - public AirPlane() { - super.setType("飞机"); - } - - public AirPlane(String brand, String color, String place) { - super.setType("飞机"); - super.setBrand(brand); - super.setColor(color); - super.setPlace(place); - } - - - @Override - public void travel() { - System.out.println("坐着" + color + brand + "客机前往" + place + "旅游"); - } - - - public String combination(String color, String brand) { - return color + brand; - } - - - public String combination(String brand) { - return brand; - } - } - -} diff --git "a/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/AirPlane.java" "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/AirPlane.java" new file mode 100644 index 0000000..5af3289 --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/AirPlane.java" @@ -0,0 +1,18 @@ +package com.java.minxi.java_20240508.java_2302_黄春雪_2344310240; + +public class AirPlane extends Vehicles { + public void travel2(){ + System.out.println("坐着" + this.colour+this.brand + this.type + this.place+"旅游"); + } + public void travel3(){ + System.out.println("坐着" + this.colour+this.brand + this.type + this.place+"旅游"); + } + //成员方法:编写带有汽车颜色和品牌两个参数及String返回值的方法 combination(); + public void combination(String colour ,String brand){ + + } + //成员方法:编写带有品牌参数及String返回值的方法 combination(); + public void combination(String brand){ + + } +} \ No newline at end of file diff --git "a/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Car.java" "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Car.java" new file mode 100644 index 0000000..5f73596 --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Car.java" @@ -0,0 +1,28 @@ +package com.java.minxi.java_20240508.java_2302_黄春雪_2344310240; + +public class Car extends Vehicles { + + // + // 成员方法:重写交通工具中的 travel() 方法 + public void travel(){ + System.out.println("开着" +this.colour + this.brand + this.type + this.place+"旅游"); + } + public void travel1(){ + System.out.println("开着" + this.colour+this.brand + this.type + this.place+"旅游"); + } + + + + + + //成员方法:编写带有汽车颜色和品牌两个参数及String返回值的方法 combination(); + public void combination(String colour ,String brand){ + + } + //成员方法:编写带有品牌参数及String返回值的方法 combination(); + public void combination(String brand){ + + } + +} + diff --git "a/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Main.java" "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Main.java" new file mode 100644 index 0000000..03c8c86 --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Main.java" @@ -0,0 +1,41 @@ +package com.java.minxi.java_20240508.java_2302_黄春雪_2344310240; + +public class Main { + public static void main(String[] args) { +//开着白色大众汽车前往北京旅游; + Car car = new Car(); + car.colour = "白色"; + car.brand = "大众"; + car.type = "汽车"; + car.place = "北京"; + car.travel(); + + +//开着奔驰汽车前往东山岛旅游; + Car car1 = new Car(); + car1.colour = ""; + car1.brand = "奔驰"; + car1.type = "汽车"; + car1.place = "东山岛"; + car1.travel1(); + + +// +//坐着蓝色波音客机前往大理旅游; + AirPlane airPlane1 = new AirPlane(); + airPlane1.colour = "蓝色"; + airPlane1.brand = "波音"; + airPlane1.type = "客机"; + airPlane1.place = "大理"; + airPlane1.travel2(); +// +//坐着空客客机前往哈尔滨岛旅游; + AirPlane car3 = new AirPlane(); + car3.colour = ""; + car3.brand = "空客"; + car3.type = "客机"; + car3.place = "哈尔滨"; + car3.travel3(); + + } +} \ No newline at end of file diff --git "a/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Vehicles.java" "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Vehicles.java" new file mode 100644 index 0000000..c1e430e --- /dev/null +++ "b/work/com/java/minxi/java_20240508/java_2302_\351\273\204\346\230\245\351\233\252_2344310240/Vehicles.java" @@ -0,0 +1,67 @@ +package com.java.minxi.java_20240508.java_2302_黄春雪_2344310240; + +public class Vehicles { + String type; + String brand; + String colour; + + String place; + + public void travel(){ + System.out.println("去旅游"); + } + public void travel1(){ + System.out.println("去旅游"); + } + public void travel2(){ + System.out.println("去旅游"); + } + public void travel3(){ + System.out.println("去旅游"); + } + + + + public Vehicles() { + } + + public Vehicles(String type, String brand, String colour, String place) { + this.type = type; + this.brand = brand; + this.colour = colour; + this.place = place; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public String getColour() { + return colour; + } + + public void setColour(String colour) { + this.colour = colour; + } + + public String getPlace() { + return place; + } + + public void setPlace(String place) { + this.place = place; + } + +} -- Gitee