howd you draw class digarams


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: howd you draw class digarams

  1. #1
    Join Date
    Mar 2004
    Posts
    7

    howd you draw class digarams

    for example from the follwing code,:

    import javax.swing.*;

    public class PriceOfCoffee {

    public static void main(String[] args) {

    int numberOfUnits, unitWeight;
    final double pricePerPound=5.99;
    double totalPrice, totalPriceWithTax;
    final double salesTax=0.0725;

    String inputStr;

    inputStr = JOptionPane.showInputDialog(null, "Number of bags sold: ");
    numberOfUnits = Integer.parseInt(inputStr);

    inputStr = JOptionPane.showInputDialog(null, "Weight per bag: ");
    unitWeight = Integer.parseInt(inputStr);
    // computation
    totalPrice = unitWeight * numberOfUnits * pricePerPound;
    totalPriceWithTax = totalPrice + totalPrice * salesTax;

    System.out.println("Number of bags sold: " + numberOfUnits);
    System.out.println(" Weight per Bag: " + unitWeight + "lb");
    System.out.println(" Price per pound: $" + pricePerPound);
    System.out.println(" Sales tax: 7.25%");
    System.out.println(""); // miss a line
    System.out.println(" Total price: $" + totalPriceWithTax);

    }
    }

  2. #2
    Join Date
    Feb 2004
    Posts
    808
    varies according to the university or boss who is asking

    i would draw a big square box
    in the top left corner i would list the member variables, using italics for private/protected ones

    then i would draw a sequence of rectangles sticking out of the right hand side of the box, with the method names, public-ness and expected arguments in them. see the attachment

    this might not be how your uni expects. CHECK.

    also, final variables should BE_WRITTEN_LIKE_THIS, k?
    Attached Images Attached Images
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  3. #3
    Join Date
    Feb 2004
    Posts
    808
    tries a gif...
    Attached Images Attached Images
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  4. #4
    Join Date
    Mar 2004
    Posts
    635
    You can use a program like Visio to draw diagrams like relational or flow charts.

  5. #5
    Join Date
    Feb 2004
    Posts
    808
    lol, but for the amount of time it takes to load visio, and learn it.. might as well use paint!! or word.. lol
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center