|
Exercises
By 
February 2001
[Short Course | About This Short Course]
Exercise Outline
Welcome to the jGuru exercises for the Language Essentials Short Course.
The introductory exercises demonstrate how to design Java classes and simple Java applications. The main objective is to get accustomed to Java syntax in an object-oriented programming framework.
About Exercises
A jGuru exercise is a flexible exercise that provides varying levels
of help according to the student's needs. Some students may complete the
exercise using only the information and the task list in the exercise
body; some may want a few hints (Help); while others may want a step-by-step
guide to successful completion (Solution). Since complete solutions
are provided in addition to help, students can skip an exercise and still complete later exercises that required the skipped
one(s).
The Anatomy of an Exercise
Each exercise includes a list of any prerequisite exercises, a list
of skeleton code to start with, links to necessary API pages,
and a text description of the exercise's educational goal. In addition,
buttons link you to the following information:
- Help: Gives you help or hints on the
current exercise, an annotated solution. For ease of use,
the task information is duplicated on the help page with the
actual help information indented beneath it.
- Solution: The
<applet>tag and Java source resulting in the expected behavior.
- API Documentation: A link directly to
any necessary online API documentation.
Exercise Design Goals
There are three fundamental exercise types that you may encounter:
- "Blank
screen"
- You are confronted
with a "blank screen" and
you
create the entire desired functionality yourself.
-
Extension
- You extend the functionality of an existing, correctly-working program.
- Repair
- You repair undesirable behavior in an existing program.
To make learning easier, exercises, where possible, address only
the specific technique being taught in that exercise. Irrelevant,
unrelated, and overly complex materials are avoided.
Where possible, exercises execute on the Web. However, exercises
that must access Java features or library elements that could cause
security violations are not executed on the web.
Testing the Java Environment with SimpleProgram
This exercise introduces Java compilation and program execution.
Educational goal(s):
- Understand Java compilation and interpretation
- Develop and test a Java application
- Execute a Java application
- Become acquainted with a Java development environment
-
Using Java
For Loops
This exercise asks you to use a simple for loop and a nested loop.
Educational goal(s):
- Understand how to use the
for loop
-
Using Java Arrays
This exercise asks you to define and use some simple arrays.
Educational goal(s):
- Understand how to work with arrays
-
Using Java
If Statements
This exercise asks you to define a few integer variables and test their relative values with some if statements.
Educational goal(s):
- Understand working with conditional code blocks
-
Defining and Using Java Methods
This exercise asks you to define and use some Java methods. The
methods are technically instance methods, but you can think of them as
plain old functions or procedures from your previous programming
experience.
Educational goal(s):
- Understand work to work with methods
-
The
MusicStore Class
This exercise implements a user-defined data type with one basic operation, as well as a test program.
Educational goal(s):
- Understand the
class
construct and user-defined data types
- Understand the difference between a user-defined type and an application
-
MusicStore with an Owner
This exercise adds an instance variable to MusicStore, plus an access method for retrieving its value.
Educational goal(s):
- Understand instance methods for user-defined data
types
- Understand the role of access methods
-
MusicStore: Open or Closed?
This exercise adds instance variables to MusicStore, plus access methods, conditional execution logic, and methods that return boolean and String values.
Educational goal(s):
- Become comfortable with access method usage
- Become familiar with conditional execution syntax
-
MusicStore: String Concatenation
This exercise enhances MusicStore's string processing.
Educational goal(s):
- Gain experience with
String
- Understand the importance of the
toString method for data conversions
-
MusicStore: Adding Titles
This exercise enhances MusicStore's so that it stores and displays information on multiple music titles.
Educational goal(s):
- Gain experience with array syntax
Copyright 1996-2001 jGuru.com. All Rights Reserved.
|