Welcome To The Labtest Environment!
During the test, you will not be able to access your regular home directory, access electronic mail, send or receive email, 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 prior to the
end of the test (instructions to submit your code are provided
below). If you do not submit your work on
time, you will receive a grade of zero (there will be no exceptions).
Important: When you submit a file, you must include, at
the top of the file, your name (first, last) and your Prism lab login.
These should be placed in a comment, so the file will compile.
Files that do not compile will receive a large penalty when marked,
no matter how small the error that prevented compiling.
Your task for this test is to write a simple app which calculates
and outputs the value of a simple expression involving fractions.
To store the fraction values, you must use the type.lib.Fraction class.
Your program should be called Expression.java. As shown in the sample runs below, it should prompt for and then read in integer values a b c d e and f (in that order) and then calculate and output the value of the following expression:
a c - + - b d ------- e - fAgain: you must use the type.lib.Fraction class.
Below are two sample runs of a correctly written Expression.java program.
Your output (including prompts) should be identical to that shown here.
(Of course the '%' signs are shell prompts and not part of the output.)
Note that sample user input (e.g., 1 2 1 2 3 4) is also shown here.
%
% java Expression
Enter values for the 3 numerator denominator pairs: 1 2 1 2 3 4
The expression as an unquoted proper fraction is 1 1/3.
The expression as a double output to 2 decimal places is 1.33.
%
% java Expression
Enter values for the 3 numerator denominator pairs: 12 35 34 16 13 9
The expression as an unquoted proper fraction is 1 2579/3640.
The expression as a double output to 2 decimal places is 1.71.
%
You should use good programming practices as described in the text. Your code should conform to the style guide in the text. If you cannot set the size of tabs in your editor, then use spaces instead of tabs. Do not use any features of java not covered in the first four chapters of the text.
You have about 90 minutes to complete this test
(i.e. till the end of the regular lab period).
No additional time will be provided and the machines will be switched out
of lab test mode automatically.
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.
Here are the common APIs that you may access:
Submit the class Frustrum.java before the time deadline.
Here is the command to submit your work
(further details regarding the submit command can also be
obtained by
typing man submit
Once again, you are encouraged to submit
regularly.
Newer submissions overwrite older ones.
submit 1020 labtest1W7 Expression.java