From 4cdf153823e64e2d6b6ac9b52ec3222421309d1d Mon Sep 17 00:00:00 2001 From: polarbear168 Date: Tue, 23 Apr 2024 23:39:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 +++ .idea/misc.xml | 6 ++ .idea/modules.xml | 8 +++ .idea/vcs.xml | 6 ++ java2302.iml | 11 ++++ .../f$goods.java" | 38 +++++++++++++ .../goods.java" | 57 +++++++++++++++++++ 7 files changed, 134 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 java2302.iml create mode 100644 "work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/f$goods.java" create mode 100644 "work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/goods.java" diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..6f29fee --- /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..8ef462e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/java2302.iml b/java2302.iml new file mode 100644 index 0000000..bff56e4 --- /dev/null +++ b/java2302.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/f$goods.java" "b/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/f$goods.java" new file mode 100644 index 0000000..ded2e9a --- /dev/null +++ "b/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/f$goods.java" @@ -0,0 +1,38 @@ +package java_2302_郑志红_2344310225; + +import com.sun.jdi.connect.LaunchingConnector; + +public class f$goods { + public static void main(String[] args) { + goods gs1 = new goods(); + gs1.brand ="海尔洗衣机"; + goods.LaundryService( gs1.brand); + + goods gs2 = new goods(); + gs2.brand ="美的电饭煲"; + goods.cooking(gs2.brand); + + goods gs3 = new goods(); + gs3.brand ="海尔冰箱"; + gs3.weight = 50; + System.out.println(gs3.brand+"有"+gs3.weight+"kg重"); + goods gs4 = new goods(); + gs4.brand = "大金空调"; + goods.cool(gs4.brand); + goods.heating(gs4.brand); + + + //2 + gs1.setBrand("海尔洗衣机"); + System.out.println(gs1.getBrand()+"正在洗衣服"); + gs2.setBrand("美的电放锅"); + System.out.println(gs2.getBrand()+"正在炖鸡汤"); + System.out.println(gs3.getBrand()+"有50kg重"); + gs4.setBrand("大金空调"); + System.out.print("真在"); + + + + + } +} diff --git "a/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/goods.java" "b/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/goods.java" new file mode 100644 index 0000000..a82c17c --- /dev/null +++ "b/work/java_2302_\351\203\221\345\277\227\347\272\242_2344310225/goods.java" @@ -0,0 +1,57 @@ +package java_2302_郑志红_2344310225; + +public class goods { + String brand;//品牌 + int weight;//重量 + String category;//种类 + + //方法 + public void setBrand(String brand){ + this.brand = brand; + } + public String getBrand(){ + return brand; + } + public void setWeight(String brand){ + this.weight = weight; + } + public int getWeight(){ + return weight; + } + public void setCategory(String category){ + this.category = category; + } + public String getCategory(){ + return category; + } + static void LaundryService(String brand ){ + System.out.println(brand+"正在洗衣服"); + } + static void cooking(String brand){ + + System.out.println(brand+"正在炖鸡汤"); + } + + static void cool(String brand){ + System.out.println(brand+"正在制冷"); + } + static void heating(String brand){ + System.out.println(brand+"正在制热"); + } + + + //无参构造 + public void goods(){} + //有参构造 + public void goods(String brand,int weight,String category){ + this.brand = brand; + this.weight=weight; + this.category = category; + } + public void start(){ + System.out.println(brand+"正在洗衣服"); + } + + + +} -- Gitee