Logout

D.1.3

Construct unified modeling language (UML) diagrams to represent object designs.

 

Teaching Note:

LINK Connecting computational thinking and program design.

 

Sample Question:

sdfsdfsf

JSR Notes:

 

UML stands for Universal Modeling Language, which is a unified, internationally agreed upon way of doing modeling of a wide variety things, including several software tasks such as flow charts, and this, class diagrams.

Below the diagrams is the actual code that would be represented by this example.


                           student class uml

 

So to be clear:

- indicates private for attributes primarily

+ indicates public

parameters are given both a name and a type, which follows a :

return values are only indicated by type, which follows a :

 

 7
 8 public class Student {
 9     
10     //Attributes
11     private String name = "not set yet";
12     private int grade = -999;
13   
14     
15     //Constructors
16     public Student(){   
17     }
18     
19     public Student(String name, int grade){
20         this.name = name;
21         this.grade = grade;
22     }
23     
24     
25     //Accessor Methods
26     public String getName(){
27         return name;
28     }
29     
30     public int getGrade(){
31         return grade;
32     }
33     
34     
35     //Modifier Methods
36     public void setName(String name){
37         this.name = name;
38     }
39     
40     public void setGrade(int grade){
41         this.grade = grade;
42     }
43     
44     
45     //Other Methods
46     public void printOutStudentInfo(){
47         System.out.println("The student's name is " + name + 
48                 ", and they are in grade " + grade + ".");
49     }
50 }
51 

 

Here is another, slightly larger UML example:

metro class

 

 

 

 

 

 

 

 

... But for what it's worth, note that I have in my website images like this, labeled "IB style", but they are ridiculous UML style, so we will stick with the standard approach above.

basic uml