老衣(之十三)

3.18老衣  

2013-03-19 17:52:09|  分类: 默认分类|字号 订阅

 
 
哪件也不好看
 
妈问,苗,哪件好看?
哪件也不好看呀,
哪件也不好看......
 
我要我爸爸活着
而不是穿这阴阳两隔的衣服
穿上就再也找不到他了

转载于:https://www.cnblogs.com/fatherZyl/p/3810220.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
衣柜管理系统可以使用面向对象的思想来设计,以下是一个简单的示例: 首先,我们需要定义一个 `Closet` 类来表示衣柜。这个类应该包含以下属性: - `name`:衣柜的名称 - `width`:衣柜的宽度 - `height`:衣柜的高度 - `depth`:衣柜的深度 - `clothes`:存放在衣柜中的衣服列表 然后,我们可以定义一个 `Cloth` 类来表示衣服。这个类应该包含以下属性: - `name`:衣服的名称 - `style`:衣服的款式 - `color`:衣服的颜色 - `size`:衣服的尺码 接下来,我们需要在 `Closet` 类中定义一些方法来管理衣柜中的衣服,比如: - `addCloth()`:向衣柜中添加一件衣服 - `removeCloth()`:从衣柜中移除一件衣服 - `findCloth()`:根据衣服的名称查找衣服 - `listClothes()`:列出衣柜中的所有衣服 最后,我们可以在一个 `Main` 类中实例化 `Closet` 和 `Cloth` 类,并调用相应的方法来管理衣柜中的衣服。 示例代码如下: ``` public class Closet { private String name; private double width; private double height; private double depth; private List<Cloth> clothes; public Closet(String name, double width, double height, double depth) { this.name = name; this.width = width; this.height = height; this.depth = depth; this.clothes = new ArrayList<>(); } public void addCloth(Cloth cloth) { clothes.add(cloth); } public void removeCloth(String name) { for (Cloth cloth : clothes) { if (cloth.getName().equals(name)) { clothes.remove(cloth); break; } } } public Cloth findCloth(String name) { for (Cloth cloth : clothes) { if (cloth.getName().equals(name)) { return cloth; } } return null; } public void listClothes() { for (Cloth cloth : clothes) { System.out.println(cloth.toString()); } } } public class Cloth { private String name; private String style; private String color; private String size; public Cloth(String name, String style, String color, String size) { this.name = name; this.style = style; this.color = color; this.size = size; } public String getName() { return name; } @Override public String toString() { return "Cloth{" + "name='" + name + '\'' + ", style='" + style + '\'' + ", color='" + color + '\'' + ", size='" + size + '\'' + '}'; } } public class Main { public static void main(String[] args) { Closet closet = new Closet("衣柜", 100, 200, 50); Cloth cloth1 = new Cloth("衬衫", "休闲", "白色", "L"); Cloth cloth2 = new Cloth("裤子", "牛仔", "蓝色", "32"); closet.addCloth(cloth1); closet.addCloth(cloth2); closet.listClothes(); closet.removeCloth("衬衫"); System.out.println("移除衬衫后:"); closet.listClothes(); } } ``` 这个示例中,我们定义了 `Closet` 和 `Cloth` 两个类,并在 `Main` 类中实例化并调用相应的方法来管理衣柜中的衣服。需要注意的是,这个示例只是一个简单的实现,实际的衣柜管理系统可能需要更多的属性和方法来满足实际需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值