Difference between revisions of "OOP Class12"
esse quam videri
(→Dymnically Adding Elements) |
|||
Line 1: | Line 1: | ||
[[Category:Object Oriented Programming]] | [[Category:Object Oriented Programming]] | ||
− | |||
− | === | + | ==Homework== |
− | |||
− | + | Create Characters class and weapons class that uses the strategy pattern | |
− | + | ==Use Case== | |
− | + | http://en.wikipedia.org/wiki/Use_case | |
− | + | Diagrams | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | http://en.wikipedia.org/wiki/Use_case_diagram | |
− | + | ||
− | + | ==Windows Course App Use Case== | |
− | + | ||
− | + | Actors | |
− | + | :particiant outside of the system | |
− | + | ||
− | + | [[Image:Actor.png]] | |
− | + | ||
+ | Activity | ||
+ | :something an actor does | ||
+ | [[Image:Activity.png]] | ||
+ | |||
+ | [[Image:Restaurant-UML-UC.png]] | ||
+ | |||
+ | Version 1 breif use case | ||
+ | |||
+ | Actor Admin | ||
+ | |||
+ | Course | ||
+ | #Add a course to the system | ||
+ | #Delete a course to the system | ||
+ | Student | ||
+ | #Add a student to the system | ||
+ | #Delete a student to the system | ||
+ | #Student add a course | ||
+ | #Student remove a course | ||
+ | |||
+ | |||
+ | [[Image:CourseUseCase.png]] | ||
+ | |||
+ | ==Home work== | ||
+ | |||
+ | Finish the consumable example. Make Beverages Consumable by dogs and humans. | ||
+ | |||
+ | http://iam.colum.edu/oop/classsource/class11/ConsoleApplicationLunch.zip | ||
+ | http://iam.colum.edu/oop/classsource/class11/Race.zip | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <!-- | |
− | |||
− | == | + | <csharp> |
+ | private void addCourseToolStripMenuItem_Click(object sender, EventArgs e) | ||
+ | { | ||
+ | AddCourse AC1 = new AddCourse(); | ||
+ | AC1.FormClosed += new FormClosedEventHandler(AC1_FormClosed); | ||
+ | AC1.Show(); | ||
− | <csharp> | + | } |
− | + | </csharp> | |
− | + | <csharp> | |
− | + | using System; | |
− | + | using System.Collections.Generic; | |
− | + | using System.Text; | |
− | + | using System.Collections; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | namespace course_registration | |
− | |||
{ | { | ||
− | + | class Course | |
− | |||
− | |||
− | |||
− | |||
{ | { | ||
− | + | public string CourseName; | |
− | + | public string CourseNumber; | |
− | + | public static ArrayList Courses; | |
− | + | ||
− | + | public Course() | |
− | + | { | |
− | + | CourseName = "Empty Course"; | |
− | + | CourseNumber = "00-0000"; | |
− | } | + | } |
+ | |||
+ | public Course(string NewCourseName, string NewCourseNumber) | ||
+ | { | ||
+ | this.CourseNumber = NewCourseNumber; | ||
+ | this.CourseName = NewCourseName; | ||
+ | } | ||
− | + | public string About() | |
+ | { | ||
+ | return "CourseName : " + this.CourseName + "\tCourseMumber :" + this.CourseNumber; | ||
+ | } | ||
− | + | public static void AddCourse(Course b) | |
− | + | { | |
+ | if (Course.Courses == null) | ||
+ | { | ||
+ | Course.Courses = new ArrayList(); | ||
+ | } | ||
+ | Course.Courses.Add(b); | ||
+ | } | ||
− | = | + | public static ArrayList GetCourseNames() |
− | + | { | |
+ | ArrayList CourseNames = new ArrayList(); | ||
+ | foreach(Course c in Course.Courses) | ||
+ | { | ||
+ | CourseNames.Add(c.CourseName); | ||
+ | |||
+ | } | ||
− | + | return CourseNames; | |
− | + | ||
+ | } | ||
− | + | public static void RemoveCourse(string CourseName) | |
+ | { | ||
+ | Course CourseToRemove = GetCourseFromCourseName(CourseName); | ||
+ | Course.Courses.Remove(CourseToRemove); | ||
+ | } | ||
− | == | + | public static Course GetCourseFromCourseName(string CourseName) |
+ | { | ||
+ | foreach (Course c in Courses) | ||
+ | { | ||
+ | if (c.CourseName == CourseName) | ||
+ | { | ||
+ | return c; | ||
+ | } | ||
+ | } | ||
+ | return null; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </csharp> | ||
+ | </csharp> | ||
− | + | --> |
Revision as of 15:05, 21 April 2011
Homework
Create Characters class and weapons class that uses the strategy pattern
Use Case
http://en.wikipedia.org/wiki/Use_case
Diagrams
http://en.wikipedia.org/wiki/Use_case_diagram
Windows Course App Use Case
Actors
- particiant outside of the system
Activity
- something an actor does
Version 1 breif use case
Actor Admin Course #Add a course to the system #Delete a course to the system Student #Add a student to the system #Delete a student to the system #Student add a course #Student remove a course
Home work
Finish the consumable example. Make Beverages Consumable by dogs and humans.
http://iam.colum.edu/oop/classsource/class11/ConsoleApplicationLunch.zip http://iam.colum.edu/oop/classsource/class11/Race.zip