teaching machines

CS 148: Lab 1 – Madeup and Project Euler

September 7, 2017 by . Filed under cs1, cs148, fall 2017, labs.

Welcome to the first lab of CS 148!

Lab is a time intended for you to work on programming exercises in a low-stakes environment and with lots of help at your disposal. Read each of these out loud with your lab partner and check them off to acknowledge your understanding:

Many of these rules were crafted out of failures from earlier offerings of this course. These are designed to maximize the number of passing grades at the end of the semester.

Checkpoint 1

Recall the Madeup models that we programmed together on the first day of class. For instance, here’s the polygon program that we wrote:

This program demonstrates two foundational ideas in computer science:

For your first checkpoint, you will apply these ideas to generate two other models.

Model A

Person A types. Visit Madeup.

Your first task is to create a chain link:

Model B

Person B types. Visit Madeup in a new tab.

Your second task is to create this funny symbol, which is used in the United Kingdom to mark a mechanic’s shop that can certify your vehicle:

Notice the rounded corners. These were automatically added by appending a named parameter to the dowel command:

dowel maxBend:1

So, use only a single yaw command to make each sharp bend, and then let the dowel command smooth it out.

When you have completed your two models, invite your instructor or teaching assistant over to offer feedback and make note of your accomplishment in the gradebook. If your instructor and TA are working with others at the moment, and you are confident that you’ve satisfactorily completed this checkpoint, please move on to the next checkpoint and catch them when they become available.

Checkpoint 2

We now leave Madeup and switch to a language that we will use most of this semester: Java.

In this course, we ask you to use the Eclipse develop environment to write Java code. Eclipse is one of many possible tools we could use to write Java. Netbeans and IntelliJ IDEA are also quite popular. There is no single best tool. We choose Eclipse because it has a very accommodating license and is widely used in industry.

Open Eclipse and follow these steps:

Now that we’ve got a place to store our code, let’s write some!

Problem A

Person A types. Visit Project Euler and register to create an account.

Pick one of the problems. Work out an algorithm on paper or markerboard in pseudocode. Then create a new class in lab01 named ProblemA. Translate your pseudocode to Java. Submit your answer to Project Euler. Fix your code until you have solved the problem.

Problem B

Person B types.

Pick a second problem, and solve it with the same process. Write your code in class ProblemB.

Once your solutions are working, show your work to your instructor or teaching assistant. Then log out and go do something amazing.