R4Es

Only available on StudyMode
  • Download(s) : 83
  • Published : February 13, 2013
Open Document
Text Preview

Weekly Outline for Systems Analysis and Design

(2013 by Dr. Liping Liu

Week 2:
Lecture 1: Three Different Class and Objects

Real world objects ( Conceptual objects ( Programming Objects

Real World Classes ( Conceptual classes ( Programming classes

[pic] These are real world objects, and their groups are real world classes.

Model objects are the representation of real world objects using symbols, and the groups of the same kind is a conceptual class. In UML, here is an example of a conceptual class

[pic]

Real world objects may be related and these relationships are also modeled as conceptual relationships among conceptual objects. For example, the following diagram shows that both students and professors are special kinds of users.

[pic]

For another example, the following diagram shows that employees are associated with other employees through supervising relationship and RegistrationForm objects needs to know RegistrationManager objects.

[pic]

UML stands for Unified Modeling Language. Here is how it came from:

[pic]

Programming objects are merely memory blocks that hold both data and functions. They are all created by some templates, which are programming classes.

Person objJohn = new Person(“John”, “12/23/1987”, “Male”); Person objLisa = new Person(“Lisa”, “1/2/1990”, “Female”);

Lecture 2: Super and sub classes connected by inheritance relations i. Reason 1: there is already a class that has some methods you want to use but does not fit your needs exactly ii. Reason 2: There is a need to deal with a large number of objects that are similar overall but have some differences. Lecture 3: Using Protected and Virtual keywords:

iii. Protected: mark a variable, method, or property that can be accessible to children but not to outsiders iv. Virtual: mark a method that can be overridden by children classes

Example 1: Create the employee with three data members: name, job, salary, and hire date, and a behavior to tell how long he has been with the company and another behavior to tell how much the employee is making.

class Employee {
protected string _Name;
protected string _hiredate;
protected double _salary;

public Employee()
{
_Name = “John Doe”;
_hiredate = “01/01/1900”;
_salary = 0;
}

public string Name {
get
{
return(_Name);
}

set
{
_Name = value;
}

public int HireYears()
{
DateTime hireDate = new DateTime();
hireDate = Convert.ToDateTime(_hiredate);
return DateTime.Today.Year – hireDate.Year;
}

Public virtual double TotalIncome()
{
return _salary;
}

public double salary
{
get { return _salary;}
set { _salary = value;}
}
}

Now design a salesman class that inherits the Employee class. In addition, all salesmen have an additional data member “Commission”, and their total income must also include the commissions.

public class Salesman : Employee
{
protected double _commissions = 0;

public double _commissions
{
get { return _commissions;}
set { _commissions = value;}

}

Public override double TotalIncome()
{
return _salary + _commission;
}

public Salesman(): base()
{
_commission = 0;
}

public Salesman(string aName, string aHiredate)
{
_name = aName;
_hiredate = aHiredate;
_salary = 0;
}

}

Lecture 4: Class Diagrams
v. Each class is represented by a rectangle with three compartments: class name, data member, and methods vi. Draw a pointed arrow from each sub class to its immediate super class representing inheritance vii. The standard...
tracking img