繁体   English   中英

创建UML类图

[英]create UML classes diagram

我有一个项目要做。 我有一个市场,有很多产品,每个产品都有名称,生产日期等。我已经为该项目制作了课程,但是我需要绘制课程图,但是我不知道怎么做。 另外,我想将客户数据插入文件中,例如他们所购买的商品和价格,每个客户可以购买许多购买卡。 谁能帮我?

 class product  implements Cloneable{
     String productName;
     String Description;
     int quantity; 
     product category;

     product(){}
     product(product p){}

     /** Returns a deep clone of this */
     public Object clone() {
         product p = new product();
         return p;
     }

 }

 class Beverage extends product{
     int capacity;

     public void setCapacity(int capacity) {
        this.capacity = capacity;
     }
 }

class  Condiment extends product {
    String country;

    public void setCountry(String country) {
        this.country = country;
    }
}

class Dairyproduct extends product  {
    Date  productionDate;
    Date ExpirationDate;
    String  saleUnit;

    public void setProductionDate(Date productionDate) {
        this.productionDate = productionDate;
    }

    public void setExpirationDate(Date ExpirationDate) {
        this.ExpirationDate = ExpirationDate;
    }

    public void setSaleUnit(String saleUnit) {
        this.saleUnit = saleUnit;
    } 
} 

class Customer{
    String Fname;
    String Lname;
    int Id;
    String Address;

    public void setFname(String Fname) {
        this.Fname = Fname;
    }

    public void setLname(String Lname) {
        this.Lname = Lname;
    }

    public void setId(int Id) {
        this.Id = Id;
    }

    public void setAddress(String Address) {
        this.Address = Address;
    }

 }

 class PurchaseCard{
     Date PurchaseDate;
     LocalDateTime PurchaseTime;
     Map<product,Boolean> PurchasedProducts ;
     double TotalPrice;
 } 

如果您已经有了代码,并希望基于该代码生成类图,则建议尝试在IDE中使用内置插件。 例如,IDEA可以生成具有依赖关系的类图。

如果您想从上创建架构,我强烈建议您使用Visual Paradigm (它们有30天的试用期,您将能够进行所需的自定义)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM