0

I previously posted a question but I could not get a clear answer. I am having a trouble drawing a sequence diagram for my school assignment. I've been googling SD, but there was no detailed in-depth tutorials. What I am trying to do here is to create SDs for some functions, three to be specific, and I would like my drawings to be checked before submitting. I am posting one of my sequence diagram followed by a code written in JAVA.

enter image description here

post.makePayment(); // this is called first.
============================================
public class POST {
private Store store;
private ProductCatalog catalog;
private Sale sale = null;

public POST(Store store, ProductCatalog catalog) {
    this.store = store;
    this.catalog = catalog;
}

public void enterItem(int upc, int qty) {
    if (sale == null) {
        Date date = new Date(System.currentTimeMillis());
        sale = new Sale(date);
    }
    ProductSpec s = catalog.spec(upc);
    sale.makeLineItem(s, qty);
}

public void makePayment() {
    if (sale != null) sale.makePayment();
}

public void endSale() {
    store.addCompleteSale(sale);
    sale = null;
}
} // This is the class POST.

==========================================================
public class Store {
protected ArrayList<Sale> completedSales = null;

public Store() {
    completedSales = new ArrayList<Sale>();
}

public void addCompleteSale(Sale sale) {
    completedSales.add(sale);
}
} // the class Store.

Furthermore, I am riddled by how to treat functions that are pointed...(?) for example, just like the one post.endSale() I get it that a main body in a TestPOS is calling the function that are defined in a class POST, instance post being specific, but where should I draw the line endSale() in a sequence diagram?

SW Jeong
  • 138
  • 1
  • 11

0 Answers0