Algorithms and OOD (CSC 207 2013F) : Labs
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [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: 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 can 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
Java formatting conventions.
Return to the Main
class. Insert code to 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 square
(double)
.
Correct that error.
Commit and push your changes.
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 attempt to rewrite it in Java.
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [IRC] [Teaching & Learning]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013 Samuel A. Rebelsky.
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.