|
Welcome to the Labtest Environment
|
|
During
the test,
you will not be able to access your regular home directory,
access, receive, or send e-mail, print, or access the Internet.
At the end of your test session,
this machine will be converted back to a standard, unrestricted
Prism Lab machine.
At this time, any files written by you during the test,
except those that have been submitted,
will not be recoverable.
Make sure you submit your code
before the end of the test .
(Instructions to submit your code are below).
If you do not submit your work on time,
you will receive a grade of zero.
(There are no exceptions).
|
|
Time Limit
You have about 80 minutes
to complete this test (regular lab time).
The computers will automatically shutdown at the end of the lab
(e.g., 3:50pm),
warning you several minutes in advance.
No additional time will be provided,
so you must submit your work prior to this;
otherwise, there will be no way to recover it (it will be lost),
and you will receive a grade of zero (no exceptions).
You are encouraged to submit often during the test.
Newer submissions overwrite older ones.
|
|
Submitting Your Work
When
you submit a file,
you must include at the top of the file your name (surname, given name)
and your Prism lab login.
These should be placed in a comment so that the file will compile.
Note that files which do not compile will receive a large penalty
when marked,
no matter how small the error that prevented compiling.
Submit the class NameList.java
before the time deadline.
Here is the command to submit your work:
-
%
submit 1020 midtermM2.30 NameList.java
(Further details regarding the submit command can also be
obtained by typing man submit.)
Once again, you are encouraged to submit regularly.
Newer submissions simply overwrite older ones.
Unlike eCheck assignments,
there is partial credit possible.
If you are able to finish all aspects of the program
(for example, say, input validation was requested
but you did not do this),
you should still check it in.
|
|
Useful APIs
Here
are the common APIs that you may access:
|
|
|
|
Write a Java application
called NameList.java.
It should prompt for, and read in, a character split.
It should then prompt for, and read in, a list of names,
one per line.
(The case of the split letter does not matter.
"M" and "m" should split the same way.)
Each name will be a given name ("first" name)
followed by the surname (family name),
with a space between them
(e.g., "John Smith").
The input and output here are standard I/O;
i.e., unless redirected,
input comes from the keyboard and output goes to the screen.
To signal end of file or no more input
on a Unix system, just type <ctrl>d
(the control key and letter d at the same time)
at the start of a line.
(In the sample output below, the <ctrl>d typed by the
user is not shown.)
After reading each name,
the program should present the name as
"surname, given-name"
(e.g., "Smith, John").
It should report that the person goes to Lecture Hall A
if their surname comes before the split letter
or starts with it,
or that they go to Lecture Hall B otherwise.
Your output format should conform to that shown below
in the sample output.
You should use the String class
and the appropriate methods in it.
You will lose marks for implementing functionality yourself
if an appropriate String method could have been used
easily instead.
Also remember good programming style.
Style is graded too.
|
|
Sample Runs
Here
are two sample runs of a correctly written program.
Anything typed by the user is shown in red.
% java NameList
Enter the split letter:
m
Enter names, one per line:
Parke Godfrey
Godfrey, Parke : Lecture Room A.
Gordon Turpin
Turpin, Gordon : Lecture Room B.
Tommy Matrix
Matrix, Tommy : Lecture Room A.
%
% java NameList
Enter the split letter:
K
Stephen Harper
Harper, Stephen : Lecture Room A.
Stephane Dion
Dion, Stephane : Lecture Room A.
Jack Layton
Layton, Jack : Lecture Room B.
Elizabeth May
May, Elizabeth : Lecture Room B.
Gilles Duceppe
Duceppe, Gilles : Lecture Room A.
|
|
Coding
You
should use good programming practices
as described in the textbook,
and your code should conform to the style guide in the textbook.
Your code should be adequately commented.
|
|
|
|