if
Due Tuesday, February 27 at 11:59 PM
By the time you have completed this work, you should be able to:
%
) operatorboolean
if / else
to conditionally execute codeMod.java
ModTest.java
IntCompare.java
IntCompareTest.java
MinMax.java
MinMaxTest.java
collaborators.txt
Mod.java
Download the Mod.java
file, and open it in jGrasp (or a text editor of your choice).
You will need to implement a method that uses modulo (%
) to make the code correctly compile and run.
You may not modify the code in the main
method.
Example output of the program is shown below, with user input shown in bold:
Enter an integer: 2 Enter a second integer: 3 Result: 2
ModTest.java
as a Test File, and Edit It
Download the ModTest.java
file, being sure to put it in the same folder/directory as your Mod.java
file.
This file contains a number of tests for the method you wrote in the previous step.
Open this file in jGrasp as a test file, using the same instructions you used in the previous lab.
You need to write a number of tests in this file, and all of them must pass.
The comments in the file provide more details.
IntCompare.java
Download the IntCompare.java
file, and open it in jGrasp (or a text editor of your choice).
You will need to implement two methods in this file which return boolean
results, reflecting whether or not one value is greater than or less than another.
The comments in the file provide more details.
You may not modify the code in the main
method.
Example output of the program is shown below, with user input shown in bold:
Enter first integer: 2 Enter second integer: 3 Less than: true Greater than: false
Further example output of the program is shown below, with user input shown in bold:
Enter first integer: 2 Enter second integer: 2 Less than: false Greater than: false
IntCompareTest.java
as a Test File, and Edit It
Download the IntCompareTest.java
file, being sure to put it in the same folder/directory as your IntCompare.java
file.
This file contains a number of tests for the methods you wrote in the previous step.
Open this file in jGrasp as a test file, using the same instructions you used in the previous lab.
You need to write a number of tests in this file, and all of them must pass.
The comments in the file provide more details.
MinMax.java
Download the MinMax.java
file, and open it in jGrasp (or a text editor of your choice).
This code in this file does something much like IntCompare.java
, only now it needs to return int
values instead of boolean
values.
The comments in the file provide more details.
You may not modify the code in the main
method.
Example output of the program is shown below, with user input shown in bold:
Enter first integer: 3 Enter second integer: 4 Min: 3 Max: 4
Further example output of the program is shown below, with user input shown in bold:
Enter first integer: 1 Enter second integer: 1 Min: 1 Max: 1
MinMaxTest.java
as a Test File, and Edit It
Download the MinMaxTest.java
file, being sure to put it in the same folder/directory as your MinMax.java
file.
This file contains a number of tests for the methods you wrote in the previous step.
Open this file in jGrasp as a test file, using the same instructions you used in the previous lab.
You need to write a number of tests in this file, and all of them must pass.
The comments in the file provide more details.
Log into Canvas, and go to the COMP 110L class. Click “Assignments” on the left pane, then click “Lab 8”. From here, you can upload your answers and your code. Specifically, you must turn in the following six files:
Mod.java
ModTest.java
IntCompare.java
IntCompareTest.java
MinMax.java
MinMaxTest.java
In addition, if you collaborated with anyone else, be sure to download collaborators.txt
and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other six files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.