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 creates
and outputs information about a pair of fractions.
To store the fraction values, you must use the type.lib.Fraction class.
Your program should be called Fractions.java. As shown in the
sample runs below, it should prompt for and then read in numerator and
denominator values for two fractions and then create the fractions
(using type.lib.Fracton) and print out information about them.
Again: you must use the type.lib.Fraction class.
Below are two sample runs of a correctly written Fractions.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 3 4) is also shown here.
%
% java Fractions
Enter values for the 2 numerator denominator pairs: 1 2 3 4
The first fraction is 1:2.
The value of the first fraction to 2 decimal places is 0.50.
The second fraction is 3/4.
The value of the second fraction to 2 decimal places is 0.75.
The sum of the two fractions is 5:4.
%
% java Fractions
Enter values for the 2 numerator denominator pairs: 23 27 -9 13
The first fraction is 23:27.
The value of the first fraction to 2 decimal places is 0.85.
The second fraction is -9/13.
The value of the second fraction to 2 decimal places is -0.69.
The sum of the two fractions is 56:351.
%
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 labtest1R7 Fractions.java