Before continuing on, be sure you’ve completed each of the following steps to prepare your computer for the course’s programming assignments. This means installing the required software and setting up the course workspace. Instructions for this can be found here.
“Pulling” course materials down from Upstream. As new lesson material or starter code for exercises is added to our central course repository, these are the steps you’ll take to download them into your own workspace repository.
git pull origin main
. We are pulling code from the course source repo into our local repo.Now for the main attraction! Let’s write a classic “hello world” program.
In IntelliJ, be sure your workspace is open. First, we want to verify that our project structure is correct. You should see a gray exercises
folder, with a blue folder titled src
inside of it. If the src
folder is not blue, right click on it and select “Mark Directory as Sources Root.” You should only have to do this once for the entire summer session.
Next, right click on the src
directory and select “New Package.” If you don’t see this option, no worries, we just need to reconfigure some settings in your IDE! Go to File -> Project Structure. A pop-up window will appear and on the left menu select Modules under Project Settings. Individually click on each of the src
folders located in your project hierarchy and mark them as sources. Then hit apply and exit.
Name your package ex00
. This is where the code for your very first exercise will go.
Now, right click on your ex00
package and select “New Java Class” and name your class HelloWorld
. It is important that you name your classes exactly as specified in the write-up. You will be prompted to add this new file to Git. Click “Add.”
At this point, you have all the correct files set up and have the scaffolding of a basic Java class ready for you. Your task for this first exercise is the following:
We go over how to write a main
method in class on 6/1 and also how to produce printed output. Once you have a valid main
method defined, a green play button will appear in IntelliJ next to its signature. You can click on this to run your program, and see if your code runs as expected!
“Push” your work up to GitHub for backup. By creating “commits”, which you can think of as versioned checkpoints in your workspace, you are not at risk of losing your work. It’s easy to revert back to an old version or to restore your entire workspace on a different computer.
main
branch, and needs to be pushed to your remote backup.USERNAME
with your GitHub username:
https://github.com/comp210-ss1-24/comp210-workspace-USERNAME
All that’s left now is to hand-in your work on Gradescope for grading!
Before doing so, you need to know that before an assignment’s deadline you can resubmit work as many times as you need to without penalty. Portions of assignments are autograded and will provide near-immediate feedback. We want you to resubmit as many times as it takes you in order to earn full autograding credit!
Login to Gradescope and select the assignment named “EX00 - Hello, world.” You’ll see an area to upload a zip file. To produce a zip file for autograding, return back to IntelliJ.
Along the bottom of your window, you should see an option to open a terminal integrated into IntelliJ.
Type the following command (all on a single line):
./submit.sh ex00
In the file explorer pane, look to find the zip file named “ex00_submission.zip”. If you right click on this file “Open in -> Finder” on Mac, the zip file’s location on your computer will open. Upload this file to Gradescope to submit your work for this exercise.
If you are getting a permission denied error, run chmod +x submit.sh
and then try again.
We are working on rewriting the script to work for Windows! Until then, please navigate to your course workspace in a File Explorer window. Then right click on the src
folder in your exercises directory and compress the directory into a zip folder. You can name it “ex00_submission.zip”
When you upload it to Gradescope, please delete any files that showed up in the src/
folder that were not actually part of ex00
.
Autograding will take a few moments to complete. For this exercise there will be no “human graded” component, but in future exercises and projects there will. Thus, you should expect to score 100 out of 100 possible points on this assignment. If there are issues reported, you are encouraged to try and resolve them and resubmit. If for any reason you aren’t receiving full credit and aren’t sure what to try next, come give us a visit in office hours!