0

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;
 } 
7
  • IF this is Java code, which it appears to be, you can use an applicaiton called BlueJ which will diagram all your classes automatically.
    – Mike Lyons
    Commented Dec 22, 2014 at 19:41
  • This isn't a homework/assignment production center. If you have specific questions, I am sure they can be answered
    – Ascalonian
    Commented Dec 22, 2014 at 19:55
  • You don' t know hiw to make uml class diagrams or how to have them being created from your existing code automagically by some tool?
    – Fildor
    Commented Dec 22, 2014 at 19:55
  • For the UML, check out these: * sourceforge.net/projects/code2uml * soyatec.com/euml2/com.soyatec.uml.doc
    – Ascalonian
    Commented Dec 22, 2014 at 19:57
  • 1
    Use draw.io. It's an online tool like visio. Commented Dec 22, 2014 at 21:14

1 Answer 1

1

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).

Not the answer you're looking for? Browse other questions tagged or ask your own question.