if
Due Wednesday, September 20 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
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.
IntEqual.java
Download the IntEqual.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 two int
inputs are or not equal to each other.
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 Equal: false Not equal: true
Further example output of the program is shown below, with user input shown in bold:
Enter first integer: 1 Enter second integer: 1 Equal: true Not equal: false
IntEqualTest.java
as a Test File, and Edit It
Download the IntEqualTest.java
file, being sure to put it in the same folder/directory as your IntEqual.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.
MinMax.java
Download the MinMax.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 determine which of two integers is greater than / less than the other.
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 6”. From here, you can upload your answers and your code. Specifically, you must turn in the following six files:
Mod.java
ModTest.java
IntEqual.java
IntEqualTest.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.