INFORMATION & COMPUTER SCIENCE DEPARTMENT, KFUPM
ICS102 SECTION 02&13 (002 Semester)
Introduction to Computing
Home Work
#04
1. Answer problem R9.5 on page 389 of the ICS102
Reference book.
2. Answer problem R9.6 on page 389 of the ICS102
Reference book.
3. Answer problem R11.15 on page 471 of the ICS102
Reference book.
4. Answer problem P9.3 on page 392 of the ICS102
Reference book
5. Answer problem P11.2 on page 472 of the ICS102
Reference book.
6. Answer problem P11.6 on page 473 of the ICS102
Reference book.
7.
A file, answers.txt whose content is shown below, consists of ID numbers and answers of
students for a multiple choice quiz (of ten questions):
975678 ADCDABCDAB
976321 ABDCCBDABA
982345 ABDCABDBBA
987987 ABDCCBDABB
996789 BDCCBDABAD
998468 CDBAADBCDC
The
key for the quiz is contained in a file, key.txt whose
content is shown below:
ABDCCBDABA
Write
a program that:
·
reads
the student answers in a 2-D array of characters and the key in a 1-D array of
characters.
·
computes
the score of each student out of 10
·
counts
the number of students that correctly answer each question
·
computes
the overall average.
·
sends
output to a file, Result.txt, whose content should be as follow:.
975678 A D C D A B C D A B 2
976321 A B D C C B D A B A 10
982345 A B D C A B D B B A 8
987987 A B D C C B D A B B 9
996789 B D C C B D A B A D 1
998468 C D B A A D B C D C 0
4 3 3 4 2 4 3 2 3 2 5.0
Submission Notes:
1.
Submit both the printed copy and the soft copy in an
envelope on or before beginning of class on Saturday, 19/5/2001.
2.
You must compile each of your classes and save the
class files on the floppy.
3.
All your programs files should be saved in a folder
HW3 on your fploppy.
4.
Code your programs according to the Java naming
conventions on this
link.
5.
Indent your work so that content of a class and
methods are pushed inside by a tab or at least three spaces.
6.
Use comments at the beginning of each program to
explain its purpose. Also include your
name and ID number as part of the comment.
7.
Use comments to explain each variable whose purpose
cannot be determined from its name.