Project 00: Java Introduction
Individual, Due: 2024 Sep 3, 11:59pm
This is a introductory assignment that walks you through the following objectives:
- install and configure IntelliJ, Java SDK, CSE LogHistory Plug-in
- understand the general assignment folder structure
- understand the requirements for each assignment
- write a simple Java program using the CSE LogHistory plug-in
- update run configurations to use test data
- modify the
readme.html
file - submit a zip file with the proper structure
Important:
Read through the entirety of these instructions and the readme.html
file before beginning.
This write up contains lots of useful information, and you might need to refer to it later in the semester.
General Information
This section contains general information about setting up the IntelliJ IDE, Java SDK, and CSE LogHistory Plug-In, the general project folder structure, and the readme file.
Installing IntelliJ, Java SDK, CSE LogHistory Plug-in
Follow these directions to install and configure IntelliJ and the CSE LogHistory Plug-in.
Be sure that the CSE LogHistory Plug-in is installed and enabled before you start modifying your code. When you open a project in IntelliJ, you should see the balloon below.

If you do not see the balloon above, do not start modifying the code, since the plug-in is not recording. Instead, you may need to reinstall or enable the plug-in as outlined in the directions.
Do not modify any of the project files for the assignment except through IntelliJ, as these changes will not be recording.
We should be able to reconstruct all of the edits that you performed by playing back the recorded history.
Receiving full credit for an assignment requires submitting a good plug-in recording.
You may modify the readme.html
file using any editor, since changes to this file are ignored by the plug-in.
Do NOT modify the .log/history.log
file.
Project Folder Structure
In general, your project folder will contain a few sub-folders and a few files. Below is an example of the folder structure along with some inlined comments. See the following text for more details.
P00_JavaIntro/ .idea/... <- Contains IntelliJ-related files .log/history.log <- Contains CSE LogHistory recordings out/... <- Contains Java Binaries src/ algs4.jar <- Java Library stdlib.jar <- Java Library BinarySearch.java <- A file that you may need to modify BruteForceSearch.java <- A file that you may need to modify HelloWorld.java <- A file that you may need to modify tests/... <- Contains test input files .cos265 <- Empty file indicating a COS265 project P00_JavaIntro.iml <- IntelliJ Project File readme.html <- Fill this out before submission!
The P00_JavaIntro.iml
file at the root and everything under the .idea/
sub-folder provide IntelliJ the details about the project.
Do not modify these files directly.
The .log/history.log
file contains the CSE LogHistory recordings.
This is a plaintext file that contains all of the changes you made to any file within the project folder while running IntelliJ.
Do not modify this file.
The out/
sub-folder contains the binaries (compiled Java files) of your code.
These files will be rewritten everytime you build your program.
Under the src/
sub-folder contains the Java source code that we provide and the Java framework / bare-bone source code files that you will modify.
All of your source code should go in this sub-folder.
Do not create, rename, move, or delete files under this sub-folder.
The src/algs4.jar
and src/stdlib.jar
files are Java libraries that contain many useful classes.
These files are provided by the Algorithms book website.
You may use only the libraries, classes, etc. that are explicitly specified in the assignment write-up.
The tests/
sub-folder contains test input files.
You are encouraged to create your own test input files.
The root folder for the project contains a .cos265
file, which is empty.
This file simply indicates that this is a COS265 project.
Do not move/rename/delete this file.
The readme.html
file is your way of documenting and reflecting over your work.
It is formatted using Markdeep.
Edit this file using your favorite text editor, and preview in your favorite web browser.
See sample readme (unformatted).
The readme.html
File
Each assignment will have a readme.html
at the root that you will modify.
This file acts as a write-up document where you will contain answers to specific questions about your implementation, answers computed by your solution, known bugs in your implementation, and other comments.
This sample readme provides an example of how to fill out the readme (unformatted).
You may modify the readme.html
file using any editor, as it is a plaintext file formatted using Markdeep.
When you open the readme.html
file in a web browser, the last few lines of the file will load and execute a Javascript program to convert the plaintext into a neatly format.
Below are screenshots of the sample readme as unformatted and formatted.
IMPORTANT: If your readme.html
contains a lot of HTML tags, you are using the wrong file!
Do not save the HTML file from the browser after it has been rendered, but instead download and work with the original source!


Important Notes
This section covers important notes about using personally identifiable information, modifying sources code, and using Java packages and features.
Personally Identifiable Information
Regardless of your participation in the research study, the readme.html
file is the only file that should contain any personally identifiable information.
Our scripts will sanitize your submissions by removing all modifications to the readme.html
file.
No other personally identifiable information will be collected unless you type it in yourself.
Again, do not type any personally identifiable information in any file except for the readme.html
.
If you include personally identifiable information in any other file, we will have to remove these entries manually.
Do not attempt to do this modification yourself.
Should you accidentally type something in a file that should not have been recorded, make a note in the readme.html
file the explains how we can find this (filename, approximate time of edit, what you typed that shouldn't have been typed, what should go there instead).
Modifying Source Code
You may modify any of the files in the project or create any additional files. However, all changes to files not indicated as modifiable in project write up and all additional files to the project will be completely ignored when tested and graded. If your solution depends on the content of these files, your solution will not receieve full credit, possibly a zero.
When you change the files indicated as modifiable, do NOT change the public API (public methods), otherwise your solution will not receive full credit, possibly a zero. You may create additional methods (private only), data members (private only), and private classes to help you solve and test your implementation. We will not test any additional code.
The public API includes all the following parts of functions, methods, and data members:
- visibility/protectedness (
public
,private
), - name,
- return type,
- argument types, and
- argument ordering.
The assignment framework will contain stubs for all public functions and classes that you will need to solve your problem. If your solution requires creating a new file or including another file, your solution is likely incorrect and needs to be reworked. Talk with me if you are having difficulty with this.
This course is at least your third computer science course. Therefore, at the very least, you are expected to submit code that compiles. Code that contains compilation errors will likely receive an automatic zero. We will not grade commented-out code or pseudo-code.
You are expected to write code that produces correct answers. However, many of the problems in this course will require handling many edge cases, require careful thought, and may require clever or creative solutions to receive full credit. Correct but inefficient code may receive only partial credit.
We strongly encourage you to write your own unit tests in the main()
method for each Java class and to create additional test data files.
We will not test this code.
Once again, do not type any personally identifiable information in any file except for readme.html
.
Java Packages and Features
Java is an extensive language, where many CS problems have been solved neatly in Java packages. Regardless, the objectives of this course are to teach you how to solve these problems on your own, building critical thinking and problem solving skills, so that you can are able to solve more challenging, unsolved problems at a later time.
Therefore, for this course, you may NOT import any Java package that is not explicitly in the initial framework or described in the respective project write up. Furthermore, you may not use any functional programming or similar language features.
You might lose points if your submission imports additional packages, and you might receive a 0 if your solution requires packages outside of what is deemed acceptable.
If you have any questions, talk to me first.
IntelliJ Information
This section provides instructions on opening and running a Java project in IntelliJ.
Opening Your First Java Project
Download the starting framework from the course LMS page and extract it.
You should see a folder called P00_JavaIntro
, and inside are a few files and sub-folders.
See the Project Folder Structure section above for details.
Now open IntelliJ, choose Open
from the welcome dialog, and select the P00_JavaIntro
folder.

IMPORTANT: Be sure you select the main IntelliJ project folder and not a similarly named parent folder.
The correct IntelliJ project folder has a small dark gray square with a horizontal line over the folder symbol, where the incorrect one does not.
In the image below, the bottom P00_JavaIntro
is the correct IntelliJ project folder (note the little symbol on the folder icon), but the top P00_JavaIntro
folder is not the correct project folder.
See IntelliJ IDE, Java SDK, and CSE LogHistory Plug-in for more information.

When you open the project, you should see something similar to the following.

IMPORTONT:
Notice that there is a balloon stating CSE LogHistory is recording changes to P00_JavaIntro (COS265)!
.
This balloon confirms that the plug-in is installed, enabled, and ready to record the changes.
If you do not see the balloon, try reinstalling the CSE LogHistory Plug-in by following the steps outlined at link.
If you see a different message, you probably opened the incorrect folder.
See link for more information.
Click the balloon's Hide Balloon
button to dismiss the dialog.
Now, if you notice that there is a yellow Project SDK is not defined
banner across the top of the editor and many words are colored or underlined in red (see image below), then you need to select the Java SDK by following the steps outlined at link.

Running the Project
Pressing the green play button (top-right or Run > Run 'HelloWorld'
) will run the main
function under the HelloWorld
file, which will open a panel along the bottom that has Hello, World!
printed in it.
This panel contains all the text that is printed to the console.
The left panel shows the project structure (similar to what was listed in the Project Folder Structure section above).
Notice that under the src
sub-folder, there are two other files, BinarySearch
and BruteForceSearch
.
These files contain stub class structure, meaning the interface is written but the code/functionality is missing.
In order to run the main
functions under these classes, you must change the run configuration.
Click on the projects drop-down that is just left of the green play button, and then choose the appropriate project.

Throughout this course you will need to pass as command line arguments the names of some files to use as input for your application.

To specify or change the command line arguments, click the projects drop-down, then click Edit Configurations...
.
Specify the command line arguments using the Program arguments
textbox.
Note that the filenames are specified from the root of the project folder.

Assignment Requirements
You will modify the BruteForceSearch
and BinarySearch
Java files under the src/
folder to perform a check every entry in a list of test numbers against a whitelist of numbers (experiment 1.1.38 from the Algorithms book).
Each Java file will perform the same action (searching for test number in a whitelist), so they will produce exactly the same results, but they will each use a different algorithm.
The algorithm in BruteForceSearch
will perform a brute-force search, and the algorithm in BinarySearch
will perform a binary search.
You will need to add import java.util.Arrays;
to your project, but do not import any other packages.
Read the paragraphs titled Whitelisting and Performance on page 48.
Then modify the BruteForceSearch
and BinarySearch
files under the src/
folder to match the algorithms provided on pages 48 and 47 (respectively).
Rather than taking input from console (StdIn
), modify the two search main
functions to accept two parameters, where the first specifies the filename of the whitelist, and the second specifies the filename of what is to be checked.
Use the readInt
function in the In
class provided by stdlib.jar
to read in each of the integers.
Your modification should look like the following code snippet.
In test = new In(args[1]); while(!test.isEmpty()) { int t = test.readInt(); if(rank(t, whitelist) < 0) { StdOut.println(t); } }
Test both of your implementations using the tinyW.txt
and tinyT.txt
files.
Then compare results of both implementations using the largeW.txt
and largeT.txt
files.
It is important to run the implementation twice, considering only the timing of the second run, because the first run may include many things that do not relate directly to the execution of the rank
functions.
Notice that BruteForceSearch
and BinarySearch
perform the same action, but their running times are very different.
Open the readme.html
file and answer the questions.
See the sample readme as an example.
Submission
Once you have completed the assignment requirements, submit your project as a Zip file to the course LMS page.
IMPORTANT: Modern operating systems have built-in features to create Zip files, however the OS sometimes miss including critical files! Instead, use the two options below which are provided by the CSE LogHistory plug-in.
When you open a project, the plug-in shows a balloon with a Zip Project
button.

Alternatively, click the "hamburger menu" in the top-left corner, then click Find Action...
under the Help
menu item.
Type Zip
into the textbox in the window that pops up, then click Zip Project
.


Clicking either of these will generate a .zip
file in the root of your project folder.
The Zip file will contain nearly every file in your entire project, including your recorded log.
The only exceptions are the out/
and tests/
folder, because they either contain Java binaries that are reproducible or potentially very large test files.
Grading Rubric
Submission | |
3pts | Submission contains all files |
3pts | Working CSE LogHistory Plug-in .log/history.log file |
Correctness | |
3pts | Correct implementation behind BruteForceSearch API |
3pts | Correct implementation behind BinarySearch API |
Performance | |
3pts | BinarySearch meets time constraints (only if ≥2pts correct) |
Readme | |
3pts | Completed readme.html |