Java Reference
In-Depth Information
Enter part number (E to end): gsf55
Part not found
Enter part number (E to end): gsf555
Enter amount sold: 1
Amount remaining: 8
GSF555 Gas-Filter 8 4.50
Enter part number (E to end): e
eXerCISeS 7
1.
What is the difference between a file opened with "r" and one opened with "rw" ?
2.
Write a program to determine whether two binary files are identical. if they are different, print
the first byte number at which they differ.
3.
Write a program to read a (binary) file of integers, sort the integers and write them back to
the same file. assume that all the numbers can be stored in an array.
4.
repeat (3) but assume that only 20 numbers can be stored in memory (in an array) at any
one time. hint: you will need to use at least 2 additional files for temporary output.
5.
Write a program to read two sorted files of integers and merge the values to a third sorted file.
6.
Write a program to read a text file and produce another text file in which all lines are less
than some given length. Make sure to break lines in sensible places; for example, avoid
breaking words or putting isolated punctuation marks at the beginning of a line.
7.
What is the purpose of creating an index for a file?
the following are some records from an employee file. the fields are employee number (the
key), name, job title, telephone number, monthly salary and tax to be deducted.
STF425, Julie Johnson, Secretary, 623-3321, 2500, 600
COM319, Ian McLean, Programmer, 676-1319, 3200, 800
SYS777, Jean Kendall, Systems Analyst, 671-2025, 4200, 1100
JNR591, Lincoln Kadoo, Operator, 657-0266, 2800, 700
MSN815, Camille Kelly, Clerical Assistant, 652-5345, 2100, 500
STF273, Anella Bayne, Data Entry Manager, 632-5324, 3500, 850
SYS925, Riaz Ali, Senior Programmer, 636-8679, 4800, 1300
assume that the records are stored in a binary file in the order given.
a.
how can a record be retrieved given the record number?
b.
how can a record be retrieved given the key of the record?
Search WWH ::




Custom Search