Prev | 06 Names | Chapter 5 | lab06 C/C++ Scoping |
Today | ** Project Phase 1 | UML of old+Proposed changes(10 pts) | |
Today | 07 Data Types | Chapter 6 | lab07 C/C++ Data |
Next | 08 Expressions etc | Chapter 7 not section 8 | lab08 C/C++ Expressions |
2. Answer review questions at end of chapter 6 .
3. Hand in 2 or more answers to review questions.
CSCI 330 (Data Structures) is an in depth study of this material.
Integer arithmetic using binary can also break the rules of accountancy. For example taking an annual salary of $10,000 and representing it as an integer 10000, and dividing it by 12 to get the monthly salary means you get 833 per months.... or $9996 total -- and your employee could pocket $4. Most countries specify rules that pay more in some months and less in others so that the total is correct and each month is close to the mathematical division.
Enumerations in the UML (6.4.1) are shown as a class with stereotype
<<enumeration>>and with the values listed as attributes. In the OCL they are written:
enum{ value1, value2, ...}Their values are written
#Value1, #Value2, ...in the OCL.
In place of array types (6.5) we have multiplicities(0..*, 4..5, ...). Put them on attributes in square brackets and links.
grade[30]:GradeThere are also special OCL types: Collection, Set, Bag, and Sequence.
Record types (6.7) are UML classes with no operations and all attributes public. Composition is a good way to show fields in a record.
Unions (6.8) are best treated by generalizations and multiple inheritance.
Pointers (6.9) have no special UML type. Do not use "*" to indicate pointers in the UML! The aggregation link is the old way for saying that one type of data has a pointer that refers to an object of another type. Make sure that (1) the name of the pointer is the role, (2) there is an arrow head, and (3) the multiplicity is 0..1. However, aggregation is not really intended to model pointers. Modern UML users just use an association with an arrow to show a pointer.