Algorithms and OOD (CSC 207 2014F) : Labs
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [Learning Outcomes] [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Readings]
Reference: [Student-Curated Resources] [Java 8 API] [Java 8 Tutorials] [Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2014S (Rebelsky)] [CSC 207 2014F (Walker)] [CSC 207 2011S (Weinman)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Summary: In this laboratory, you will read, attempt to understand, run, and occasionally correct some Java code.
Prerequisite Knowledge: Git. Using Eclipse. Java basics.
Start Eclipse.
Fork the GitHub repository for this lab, available at https://github.com/Grinnell-CSC207/lab-code-reading.
Clone your fork to the local machine.
Import the clone into Eclipse. Note: This clone is already configured as an Eclipse project, so you should be able to select rather than .
Look at the Main class and predict what the program
is supposed to do.
Confirm your hypothesis experimentally.
Look at the MathUtils class. You may note that it's
badly formatted. Find a quick way to reformat it according to the
class code-formatting conventions.
Return to the Main class. Insert code instructions print
the squares of the real numbers 0.1, 0.2, ...., 0.9. When typing,
type slowly and take advantage of the popup menus that appear.
There's a small error in . Correct that error.
square(double)
Commit your changes and push the result back to GitHub. Then revisit the GitHub page to see if they are incorporated.
Introduce some syntax errors into your Java code and see how Eclipse reacts. In each case, you should see a red x at the left of the pane. Click on the x to see what options are available. Here are some suggestions:
int from the declaration of i
in main.
i outside of the for loop.
java.io.PrintWriter with
just PrintWriter.
Mine.
square on a String.
return from the body of one of the
versions of square.
Pick a simple C program you've written previously and rewrite it in Java.