CS 142 Lab 1
Part A: Leroy and the Cookies
In Part A, you will play a game already written for you in Java. Through playing the game and investigating the code, you will practice with Java variables, if statements, and loops.
Getting started
Start IntelliJ. From the screen that appears, choose “Get from VCS.” This is new; we haven’t used this option before. We will make a new project to store all of our labs and code that I want to distribute to the whole class.
On the next screen, copy and paste in the following URL in the box that says “URL”:
https://github.com/pkirlin/cs142-f21-inclass
In the “Directory” box, double-check that the folder listed is the right place for new projects to be stored (a subfolder of your main cs142 projects). If something is off, you can click the folder icon at the far right of the text area and make a new folder for this class work.
In the left-hand panel, expand the
src
folder to see today’s lab (in thelab1
folder). Double-click onLeroyAndTheCookies
(not themd
file yet.) If you get a yellow bar at the top that says “Project JDK is not defined,” then click on “Setup SDK” and choose the JDK you downloaded earlier.In the left-hand panel, double-click on
LeroyAndTheCookies.md
. Follow the instructions in this file. This is where you will answer the questions for the lab.
Part B: One Is Zero
After you finish Part A, try to write the second program from our previous class, “One is Zero.” Directions are in the OneIsZero.java
file (or see the class webpage or your handout.)