INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
CS215 - Lec 4 single record organization
1.
2. List different methods for field
organization.
Continue with the company class;
use fixed length ,
use length indicator,
use delimiter,
use KeyWord.
Dr. Hussien M. Sharaf 2
3. Dr. Hussien M. Sharaf 3
Fixed
length
Variable length
Length
indicator
Field
delimiter
Keyword
=Value
Like Tags of
HTML and XML
4. Each field has a fixed length of bytes.
The length must be the max expected length.
Problems:
1. The estimation of max length.
2. The choice of a character to fill the remaining
space.
Dr. Hussien M. Sharaf 4
5. a) Length indicator:
To store the field length just ahead of the field.
Problems:
1. The field length must not be too long (less than
256 bytes) to be stored in a single byte.
2. Needs more programming effort.
3. Requires at least two disk trips for each field.
Dr. Hussien M. Sharaf 5
2. Variable length fields
6. b) Field delimiter:
To choose a special character that will not appear
within a field and then insert that after each field .
Problems:
1. The choice of a delimiter character that does not get
in the way of processing (ex. White space is not a
good choice cause the field may contain spaces
within it like “address fields” same for @).
Dr. Hussien M. Sharaf 6
Continue Variable length fields
7. c) Keyword = Value:
• The field provides information about itself by using a
keyword to identify each field.
Example: last=sharaf first=hussein.
• It is often combined with another format (like
delimiters) to separate each value from the keyword
of the following field.
Advantages:
1. It is easy to say which fields are contained in a file.
2. It is a good format for dealing with missing fields.
Dr. Hussien M. Sharaf 7
Continue Variable length fields
8. Dr. Hussien M. Sharaf 8
User Interface
Classes containing any
processing of data
9. //Declarations
while (ExitProgram!=true)
{ //take user choice
switch (UserChoice)
{ case 'I':
case 'i':
//handle user Choice
case'E':
case'e':ExitProgram=true; break;
}
}
system("pause");
Dr. Hussien M. Sharaf 9
10. 1. Start by determining Output.
2. List the inputs.
3. Think about processing.
11. Continue using the CompanyInfo class:
In assignment #3 we overloaded operators to read and write
comma delimited fields.
Add a method(not an overloaded operator) that takes
in ostream and writes to it a company record.
1. Fields have length indicator of type short.
2. Modify the driver(main) to use this class based on the
template Menu.
Example:
03155 03All 15A-z Maintenance 05Malek 01- 32902 Bestel Avenue - Garden
Grove..
Dr. Hussien M. Sharaf 11
12. Continue using the CompanyInfo class:
Write a method(not an overloaded operator) that
takes in istream and reads from it a company record.
1. Fields have length indicator of type short.
2. Write a driver to use this class based on the
template Menu.
Example:
03155 03All 15A-z Maintenance 05Malek 01- 32902 Bestel
Avenue - Garden Grove..
Note that the first two bytes are the length indicator.
Dr. Hussien M. Sharaf 12
13. Next week is the deadline.
No excuses.
Don’t wait until last day.
I can help you to the highest limit within the next
3 days.
Dr. Hussien M. Sharaf 13
14. 1. Delete the “bin” and “obj” folders.
2. Compress the solution folder using
winrar.
3. Rename the compressed file as follows:
StudentName_ID_A4.rar
StudentName_ID_A5.rar
4. Email to: n.abdelhameed@fci-cu.edu.eg
with your ID in the subject.
Dr. Hussien M. Sharaf 14