Link Search Menu Expand Document

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

  1. 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.

    image

  2. 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.

    image

  3. In the left-hand panel, expand the src folder to see today’s lab (in the lab1 folder). Double-click on LeroyAndTheCookies (not the md 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.

    image

  4. 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.)