Für diesen Artikel ist leider kein Bild verfügbar.

Experiments in Java

An Introductory Lab Manual
Buch | Softcover
490 Seiten
2000
Pearson (Verlag)
978-0-201-61267-7 (ISBN)
47,95 inkl. MwSt
  • Titel ist leider vergriffen;
    keine Neuauflage
  • Artikel merken
This lab manual is an appropriate supplement for any Introduction to Programming / CS1 course that uses the Java programming language. Its hands-on exercises are intended to help students improve their understanding of the fundamental structures in Java.

This manual is separated into three parts. The first part presents the core of the Java language. These six sessions provide experience with core features and principles of the Java programming language. They provide enough breadth and depth for readers to learn more of Java on their own or in further courses. The second part of the manual helps students explore some issues pertaining to algorithms. In this part, recursion is considered, as well as a few important searching algorithms. Ways to analyze algorithms are also looked at. In the final part of the manual, a number of Java-oriented sessions cover additional topics such as graphics, inheritance, and object design that are not described in the core sessions.

Samuel A. Rebelsky is an assistant professor of computer science at Grinnell College where he has designed an object-oriented data structures and algorithms course, and developed Java laboratories to support that and other introductory-level courses. He taught as a visitor at Dartmouth College from 1993 to 1997, and has taught Java to professionals and educators at the EdMedia World Conference on Educational Multimedia and the WebNet World Conference. Rebelsky's research interests include computer science education, computers in education, hypertext, and programming languages. Professor Rebelsky received his Ph.D. in computer science from the University in Chicago in 1993 0201612674AB04062001

Session J1: An Introduction to Java.


Discussion.



A hello world program.



Compilation.



Reading input.



Concatenating strings.



Variables.



Numeric input and output.



Applets.



Experiments.



Experiment J1.1: Executing your first program.



Experiment J1.2: Extending your first program.



Experiment J1.3: When things go wrong.



Experiment J1.4: Executing and extending a program with input.



Experiment J1.5: Numeric input and output.



Experiment J1.6: Your first applet.



Experiment J1.7: Some common applet errors.



Post-Laboratory Problems.



Problem J1-A: Generating verse.



Problem J1-B: Name replication.



Problem J1-C: Errors galore.



Problem J1-D: Predicting output.



Problem J1-E: Temperature conversion.



Problem J1-F: Bar graphs.



Notes.



Session J2: Objects and Methods.


Discussion.



Objects.



Creating objects.



Coordinating objects.



Building your own methods.



Creating your own classes.



Return values.



Static methods.



Detour: The main method.



Assigning objects.



Fonts and graphics for applets.



Experiments.



Experiment J2.1: Printing out a point.



Experiment J2.2: Coordinating classes.



Experiment J2.2A: Coordinating classes (graphical application).



Experiment J2.2B: Coordinating classes (textual application).



Experiment J2.3: Your own method.



Experiment J2.4: Your own class.



Experiment J2.5: Return values.



Experiment J2.6: Static methods.



Experiment J2.7: Copying objects.



Experiment J2.8: Changing the font.



Experiment J2.9: Some simple pictures.



Post-Laboratory Problems.



Problem J2-A: Shifting points.



Problem J2-B: Shifting points, revisited.



Problem J2-C: Drawing a grid.



Problem J2-D: Drawing a grid, revisited.



Problem J2-E: Happiness.



Problem J2-F: Initials.



Problem J2-G: Rainbow Text.



Problem J2-H: Other Drawing Methods.



Problem J2-I: Determining Text Width.



Notes.



Session J3: Building Your Own Classes.


Discussion.



Class capabilities.



Program state.



Object state.



Constructors.



Overloading.



Creating a bordered square class.



Experiments.



Experiment J3.1: Program state.



Experiment J3.2: Fields.



Experiment J3.3: Fields, revisited.



Experiment J3.4: Constructors.



Experiment J3.5: Constructors, revisited.



Experiment J3.6: Overloading read methods.



Experiment J3.7: Overloading.



Experiment J3.8: Borders.



Experiment J3.9: A bordered-square class.



Post-Laboratory Problems.



Problem J3-A: Shifting points.



Problem J3-B: Refined points.



Problem J3-C: Distance from origin.



Problem J3-D: A date class.



Problem J3-E: Converting dates to strings.



Problem J3-F: Stick figures.



Problem J3-G: House components.



Problem J3-H: Boxed text.



Notes.



Session J4: Boolean Expressions and Conditionals.


Discussion.



Boolean expressions.



Operations on Booleans.



Conditionals.



The switch statement.



Applet parameters.



Experiments.



Experiment J4.1: Extending the SimpleDate class.



Experiment J4.2: Simple boolean methods.



Experiment J4.3: More boolean methods.



Experiment J4.4: Improved output.



Experiment J4.5: More fun with conditionals.



Experiment J4.6: Using the switch statement.



Experiment J4.7: Applet parameters.



Experiment J4.8: More applet parameters.



Post-Laboratory Problems.



Problem J4-A: Rethinking precedes.



Problem J4-B: Incrementing a date.



Problem J4-C: Is the date valid?



Problem J4-D: Correcting dates.



Problem J4-E: Printing dates, revisited.



Problem J4-F: Printing dates, revisited again.



Problem J4-G: isWinter, revisited.



Problem J4-H: Selecting colors, revisited.



Problem J4-I: Selecting colors, revisited again.



Problem J4-J: Multiple greetings.



Problem J4-K: Parameterized drawings.



Problem J4-L: Stick figures.



Notes.



Session J5: Control Structures for Repetition.


Discussion.



Repetition while loops.



Detour: Overloading revisited for loops.



Detour: Arithmetic shorthand Loops and applets.



Experiments.



Experiment J5.1: Simple loops.



Experiment J5.2: Counting the day of the year.



Experiment J5.3: Simple for loops.



Experiment J5.4: Arithmetic shorthand.



Experiment J5.5: Rainbow text.



Experiment J5.6: A grid applet.



Experiment J5.7: A bouncing ball.



Post-Laboratory Problems.



Problem J5-A: daysUntil.



Problem J5-B: daysSince.



Problem J5-C: Reflection.



Problem J5-D: Loop mechanisms.



Problem J5-E: Grade averaging.



Problem J5-F: Maximum grade.



Problem J5-G: Revising the rainbow's shape.



Problem J5-H: Revising the rainbow.



Problem J5-I: A complete grid.



Problem J5-J: Improving the bouncing simulation.



Notes.



Session J6: Arrays and Hash Tables.


Discussion.



Counting scores.



Arrays.



Some important details.



Counting words.



Hash tables.



Experiments.



Experiment J6.1: Counting scores.



Experiment J6.2: Introducing arrays.



Experiment J6.3: Arrays and references.



Experiment J6.4: Counting words.



Experiment J6.5: Hash tables.



Post-Laboratory Problems.



Problem J6-A: Improving daysUntilStartnOfMonth.



Problem J6-B: Counting grades.



Problem J6-C: Counting different scores.



Problem J6-D: Copying arrays.



Problem J6-E: Hashing words.



Problem J6-F: Game boards.



Notes.



Session A1: Recursion.


Discussion.



Mathematics and recursion.



Fibonacci numbers.



A guessing game.



Exponentiation.



Experiments.



Experiment A1.1: Simple recursive functions.



Experiment A1.2: Factorial.



Experiment A1.3: Fibonacci numbers.



Experiment A1.4: Exponentiation.



Post-Laboratory Problems.



Problem A1-A: Printing information on recursive calls, revisited.



Problem A1-B: How large can a factorial be?



Problem A1-C: Large Fibonacci numbers.



Problem A1-D: More efficient iterative computation of Fi-bonacci numbers.



Problem A1-E: More efficient recursive computation of the Fibonacci numbers.



Problem A1-F: Understanding the Fibonacci numbers.



Problem A1-G: Counting steps during exponentiation.



Problem A1-H: From recursion to iteration.



Notes.



Session A2: Searching.


Discussion.



Sequences.



Detour: Random sequences.



Sequential search.



Detour: The number game, revisited.



Binary search.



Problems with binary search.



Finding the smaller elements of a sequence.



Experiments.



Experiment A2.1: Integer sequences.



Experiment A2.2: Random sequences.



Experiment A2.3: Sequential search.



Experiment A2.4: The guessing game.



Experiment A2.5: Binary search.



Experiment A2.6: Problems with binary search.



Post-Laboratory Problems.



Problem A2-A: An iterative binary search.



Problem A2-B: Evaluating binary search.



Problem A2-C: Searching through names.



Problem A2-D: Finding the first element.



Problem A2-E: Extending the number game.



Problem A2-F: Variations on search.



Problem A2-G: Smallest, revisited.



Problem A2-H: Further readings.



Session A3: Analyzing Algorithms.


Discussion.



Timing algorithms.



Problems with wall-clock timing.



Counting steps.



Problems with counting.



Binary search, revisited.



Finding groups of smallest entries.



Experiments.



Experiment A3.1: Wall-clock timing.



Experiment A3.2: Comparing wall-clock times.



Experiment A3.3: Counting steps.



Experiment A3.4: Comparing steps.



Experiment A3.5: Binary search.



Experiment A3.6: Finding the smallest element.



Experiment A3.7: Finding smaller elements.



Post-Laboratory Problems.



Problem A3-A: Plotting exponentiation.



Problem A3-B: Comparing exponentiation.



Problem A3-C: Plotting exponentiation, revisited.



Problem A3-D: Comparing exponentiation, revisited.



Problem A3-E: Sorting.



Problem A3-F: Sorting, revisited.



Notes.



Session G1: Graphics and Applets.


Discussion.



Applets.



Painting pictures.



A circle applet.



Colors.



Pixels vs. coordinates.



Applet dimensions.



Repainting.



Applet parameters.



Experiments.



Experiment G1.1: A colored circle applet.



Experiment G1.2: Experimenting with colors.



Experiment G1.3: Drawing vs. filling.



Experiment G1.4: Getting boundaries.



Experiment G1.5: Repainting.



Experiment G1.6: Setting parameters.



Post-Laboratory Problems.



Problem G1-A: A "real" drawing.



Problem G1-B: A parameterized face.



Problem G1-C: Rainbow text.



Problem G1-D: Repositioning the moving circle.



Problem G1-E: Multiple circles.



Problem G1-F: Looping circles.



Problem G1-G: Colors, revisited.



Notes.



Session G2: Java's Abstract Windowing Toolkit.


Discussion.



Components.



Events and control flow.



An important event.



Your first graphical application.



Adding a Quit button.



Adding more buttons.



Separate listeners.



Experiments.



Experiment G2.1: Your first AWT program.



Experiment G2.2: Creating multiple windows.



Experiment G2.3: Adding a Quit button.



Experiment G2.4: Adding a Help button.



Experiment G2.5: Improving actionPerformed.



Experiment G2.6: Building separate listeners.



Post-Laboratory Problems.



Problem G2-A: A customizable alert.



Problem G2-B: Multiple frames.



Problem G2-C: Multiple frames, revisited.



Problem G2-D: Separate frames.



Problem G2-E: Layout managers.



Problem G2-F: Widgets.



Problem G2-G: AWT widgets.



Notes.



Session G3: Java's Abstract Windowing Toolkit, Continued.


Discussion.



The AWT, reviewed.



Getting user input.



Getting numeric input.



Experiments.



Experiment G3.1: The AWT, reviewed.



Experiment G3.2: Getting input from the user.



Experiment G3.3: String manipulation.



Experiment G3.4: A simple calculator.



Experiment G3.5: Supporting real numbers.



Experiment G3.6: Adding a quit button.



Post-Laboratory Problems.



Problem G3-A: Observing the user.



Problem G3-B: Capitalization.



Problem G3-C: Passwords.



Problem G3-D: Setting the size of text fields.



Problem G3-E: Beginning a real calculator.



Problem G3-F: Adding calculation.



Notes.



Session O1: Object-Oriented Design.


Discussion.



Narratives.



Question and answer sessions.



Beginning coding.



Narrating interactions.



Diagrams of relationships.



Generalization and encapsulation.



Experiments.



Experiment O1.1: Determine potential objects and classes for an Othello simulation.



Experiment O1.2: Refining your descriptions.



Experiment O1.3: Beginning coding.



Experiment O1.4: Narrating interactions.



Experiment O1.5: Selective coding.



Experiment O1.6: Diagramming.



Experiment O1.7: Generalization.



Post-Laboratory Problems.



Problem O1-A: Describe a game.



Problem O1-B: A simple Othello interface.



Problem O1-C: Update Board.



Problem O1-D: Update Rules.



Problem O1-E: Changing Othello's board.



Problem O1-F: Changing Othello's rules.



Problem O1-G: Changing Othello's pieces.



Session O2: Inheritance.


Discussion.



Reuse.



Inheritance.



Overriding methods.



From rectangles to squares.



Multiple inheritance.



Experiments.



Experiment O2.1: Building a new point class.



Experiment O2.2: A simple extension of the Point class.



Experiment O2.3: Adding functionality to ExtendedPoints.



Experiment O2.4: Overriding methods.



Experiment O2.5: Overriding the toString method.



Experiment O2.6: From Rectangle to Square.



Post-Laboratory Problems.



Problem O2-A: Extending Points.



Problem O2-B: Putting Points on a grid.



Problem O2-C: Validating Squares.



Problem O2-D: A hierarchy of shapes.



Notes.



Session O3: Interfaces and Polymorphism.


Discussion.



Polymorphism.



Interfaces.



Generalized methods.



Generality through inheritance.



Building generalized methods with Java's interfaces.



Experiments.



Experiment O3.1: Polymorphism.



Experiment O3.2: NewPoints and PointPrinters.



Experiment O3.3: Using ExtendedPoints.



Experiment O3.4: Printing points.



Experiment O3.5: Printing revisited.



Post-Laboratory Problems.



Problem O3-A: makePrintable vs. toString.



Problem O3-B: Cloning points.



Problem O3-C: Abstract classes.



Problem O3-D: Interfaces vs. inheritance.



Problem O3-E: Defining polymorphism.



Notes.



Session X1: Primitive Types.


Discussion.



Representing integers.



Representing reals.



Coercion and casting.



Representing characters.



Precedence.



Experiments.



Experiment X1.1: Facts about integers.



Experiment X1.2: Other integer types.



Experiment X1.3: Exceeding limits.



Experiment X1.4: Facts about reals.



Experiment X1.5: The limits of reals.



Experiment X1.6: Casting.



Experiment X1.7: Facts about characters.



Experiment X1.8: Precedence.



Experiment X1.9: Concatenating strings and numbers.



Post-Laboratory Problems.



Problem X1-A: Converting cases.



Problem X1-B: Rounding or truncation?



Problem X1-C: Rounding or truncation, revisited.



Problem X1-D: Encryption.



Problem X1-E: Coercion.



Problem X1-F: Unicode representation.



Problem X1-G: Operators and precedence.



Problem X1-H: Big integers and big reals.



Notes.



Session X2: Vectors.


Discussion.



Vectors.



Other vector capabilities.



Determining the class of vector elements.



Storing primitive values in vectors.



Experiments.



Experiment X2.1: Heterogeneity and arrays.



Experiment X2.2: Vector basics.



Experiment X2.3: Testing limits.



Experiment X2.4: Additional vector methods.



Experiment X2.5: Course management.



Experiment X2.6: Modifying vector elements.



Experiment X2.7: Primitive objects.



Post-Laboratory Problems.



Problem X2-A: Default size of vectors.



Problem X2-B: Implement sets.



Problem X2-C: Other vector capabilities.



Problem X2-D: Implementing vectors.



Problem X2-E: Printing arrays.



Problem X2-F: A grading program.



Notes.



Session X3: Input, Output, Files, and Exceptions.


Discussion.



Output and System.out.



Starting to build SimpleOutput.



Output files.



Exceptions.



Closing files.



Input.



Input and System.in.



Converting strings to other types.



Experiments.



Experiment X3.1: Using System.out.



Experiment X3.2: Building your own output class.



Experiment X3.3: Output to files.



Experiment X3.4: Output to files, revisited.



Experiment X3.5: Starting to build your own input class.



Experiment X3.6: Reading numeric input.



Post-Laboratory Problems.



Problem X3-A: Printing integer arrays.



Problem X3-B: Printing string arrays.



Problem X3-C: Redirecting output to a different file.



Problem X3-D: Redirecting output to standard output.



Problem X3-E: Reading input from files.



Problem X3-F: Reading parts of lines.



Problem X3-G: Redirecting input.



Notes. 0201612674T04062001

Erscheint lt. Verlag 19.4.2000
Sprache englisch
Maße 217 x 280 mm
Gewicht 1016 g
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
ISBN-10 0-201-61267-4 / 0201612674
ISBN-13 978-0-201-61267-7 / 9780201612677
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
mit über 150 Workouts in Java und Python

von Luigi Lo Iacono; Stephan Wiefling; Michael Schneider

Buch (2023)
Carl Hanser (Verlag)
29,99
Einführung, Ausbildung, Praxis

von Christian Ullenboom

Buch | Hardcover (2023)
Rheinwerk (Verlag)
49,90