简体   繁体   中英

create UML classes diagram

I have a project to make; I have a market and many products, each one has name, date of production, etc... I have made the classes for the project, but I need to make a diagram of the classes, but I don't know how. Also I want to insert customer data in a file like what they buy and the price and each customer can have many purchase cards to buy. Can any one help me?

 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;
 } 

If you already have the code and want to generate the class diagram based on that I suggest trying built-in plugins in IDE. IDEA for example can generate class diagram with the dependencies.

If you're thinking of creating schemas upfrom I highly recommend Visual Paradigm (they have 30 days trial period and you'll be able to do the customization you need).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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