Lecture 1 - Introduction PDF
Lecture 1 - Introduction PDF
However, I will use several materials and exercises and labs problems will be collected from several books.
Category % Description
Midterm exam 25% Midterm exam
Final Exam 60% Final exam
Collection 15% Assignments, practical exam, attendance, class
participation, quizzes, research, and seminar.
22 10/20/2021
Using TDD method: Structure chart for initial
decomposition of video rental system
Video
Rental
System
23 10/20/2021
Using TDD method: Structure chart for “process
transactions” Process
Transactions
24 10/20/2021
Using TDD method: : Final decomposition of video
rental system Video
Rental
System
25 10/20/2021
Using OOD method: Responsibility-driven design
process
• Find the classes
26 10/20/2021
Using OOD method: Classes for video rental system
• Tape
• Patron
• Console
• Scanner
• Printer
27 10/20/2021
Using OOD method: Tape class
Class Responsibilities
Tape Keep track of tape identification data
Check self out
Check self in
Answer queries about location of self
10/20/2021 28
Using OOD method: Patron class
Class Responsibilities
Patron Keep track of patron identification data
Update patron identification data
Update list of rented tapes
Update billing information
10/20/2021 29
Using OOD method: Console class
Class Responsibilities
Console Check tapes in and out
Find the location of tapes
Find out about patrons
Add and remove tapes
Add, update, and remove patrons
Update patron billing information
10/20/2021 30
Using OOD method: Scanner class
Class Responsibilities
Scanner Read a bar code and return either a tape
or a patron
31 10/20/2021
Using OOD method: Printer class
Class Responsibilities
Printer Print bills
Print receipts
32 10/20/2021
Using OOD method: Video rental system: Classes,
responsibilities, and collaborators
Class Responsibilities Collaborators
Tape Keep track of tape identification data
Check self in
Check self out
Answer queries about location of self
Patron Keep track of patron identification data Tape
Update patron identification data
Update list of rented tapes
Update billing information
Console Check tapes in and out Patron
Find the location of tapes Tape
Find out about patrons Scanner
Add and remove tapes Printer
Add, update, and remove patrons
Update patron billing information
10/20/2021 33
Using OOD method: Video rental system: Classes,
responsibilities, and collaborator
Class Responsibilities Collaborators
Scanner Read a bar code and return either a tape or a Tape
patron. (This suggests that a database that links Patron
bar codes to tapes and patrons is maintained
by the Scanner class.)
Printer Print bills Tape
Print receipts Patron
34 10/20/2021
4. Design methodologies (Cont’d)
• Abstract data type (ADT): is a well-specified collection of data and a
group of operations that can be performed upon the data.
• ADT’s specification describes what data can be stored (the characteristics
of the ADT) and how it can be used (the Operations), but not how it is
implemented.
• ADT can be defined formally using a programming language or can be
described informally using English.
37 10/20/2021
6. Testing approaches
39 10/20/2021
6. Testing approaches (cont’d)
43 10/20/2021
Test driver for max function (Part 2 of 2)
for (i = 0; i < 100; i++) {
int val;
cin >> val;
if (val == -9999) // termination sentinel
break;
else
a[i] = val;
}
cout << "\nMax is " << max(a, i) << '\n';
cout << "\n\n";
return 0;
}
44 10/20/2021
Assignment
- Write a function int min(int a[],
int n) that finds the smallest item in array
a.
- Write a function int maxpos(int a[],
int n) that returns the position of the
largest item in the array.