CSCE 145 -- Fall 2007

Sections 4, 5, 6

Introduction to Algorithmic Design

Homework Assignments

Homework Assignment 11

Due midnight, Thursday, 6 December 2007.

The assignment can be found on a separate page.

Homework Assignment 10

Due midnight, Wednesday, 28 November 2007.

The assignment can be found on a separate page.

Homework Assignment 9

Due class time, Wednesday, 14 November 2007.

The assignment can be found on a separate page.

Homework Assignment 8

This program involves:

  • Collaborating classes
  • ArrayLists
  • Some more fun with Strings

Do problem 8.9 on page 457 of your text. Make sure you use the class diagram on page 458.

Make sure the driver you create demonstrates all the methods and functionality of the program with multiple items. When you return the receipt from checkout make sure you format it nicely (it'll be printed it to the screen in the driver). It should include a list of all the items with their price, the total number of items, and the total price.

HINT: the checkout method returns a String, but that doesn't mean the receipt has to be all on one line; if you put "\n" in a string it will insert a line break; "\t" makes a tab. If your string gets too long to see on one screen in Eclipse you can separate it out like this:

String oneString = "This is all on line " +
   "one.\n And this is on line 2.";

Your receipt may look something like this:

-----------------------
   Joe's Food Shack
-----------------------
8:58pm November 11 2007

Broccoli        3.57
Hamburgers      5.99
Beer            38.00

Total Items: 3
Total Price: $47.56

Thanks and come again!
-----------------------

You don't have to make it look exactly like this, but make it look nice and be creative.

Homework Assignment 7

Due class time, Wednesday, 31 October 2007.

In this homework you will gain experience modifying code you've already written. This underscores the importance of writing code that's well-commented, well-formatted, and clear. This homework also gives you more practice with instance variables and String manipulation.

Add the following services to the Sentence class you developed in lab 16:

isPalindrome: A palindrome is a word or sentence that's exactly the same backwards and forwards. For example, "madam" or "able was I ere I saw elba". This method should return a boolean that indicates if the current String stored in your Sentence class is a palindrome.

convertToPigLatin: This function should convert the current String stored in your class to a simplified version of Pig Latin and return it as a String. The rules for this simplified Pig Latin are for any words beginning with a consonant, move the first letter of the word to the end of the word and add "-ay"; if the first letter is a vowel, just add "-way" to the end.

Modify your driver as well to test these methods.

Homework Assignment 6

(There will be no homework assignment due on 17 October because of fall break.)

Due class time, Wednesday, 24 October 2007.

The text for this assignment is quite long and is on a separate page.

Homework Assignment 5

Due class time, Wednesday, 10 October 2007.

This homework is based on chapter 5, non-trivial branching.

Do problem 5.16 on page 267 of your text.

Don't let parts (a) and (b) confuse you; just write one followWallRight method for your MazeWalker robot. Use (a) and (b) as guidance while devising an algorithm for followWallRight.

Also, write predicates leftIsBlocked and rightIsBlocked and use them in followWallRight.

Homework Assignment 4

Due class time, Wednesday, 26 September 2007.

Objective: Learn how to make decisions and control computation via loops and branches.

From Chapter 4 of the textbook, do problem 4.11 on page 208.

Upload the assignment (java and class files) to the dropbox.

Homework Assignment 3

Objective: Learn how to write and use threads.

Due class time, Wednesday, 19 September 2007.

From Chapter 3 of the textbook, do problem 3.10 on page 163.

Upload the assignment (java and class files) to the dropbox.

Note that at this point you are starting to have problems that can be "solved" in several different ways. Part of your documentation for the code should be a top level description of how you solve the problem, and what methods you are using as part of breaking down the problem into smaller bits. A very crucial part of the documentation will be

  • What are the initial conditions you assume for the method (location of robot relative to the task at hand, direction of the robot, etc.)
  • What's the notion you use for controlling the motion of the robot to get from where it is to where it needs to be?
  • In what configuration (again, location, direction, etc.) do you leave the robot when the method finishes?

You should be thinking of these sub-methods as black boxes that can be used later, so the documentation should be clear as to how such a black box could be used several months from now when you have forgotten the details of what you did.

Homework Assignment 2

Objective: Learn Eclipse and how to invoke object methods.

Due midnight, Wednesday, 12 September 2007.

From Chapter 2 of the textbook, do problem 2.13 on page 110.

Upload the assignment (java and class files) to the dropbox.

Homework Assignment 1

My bad. I somehow didn't get the memo making the first homework assignment, so I didn't ask you for it. We will skip this sequence number so we can be in the same sequence as the other classes.

Homework Assignment 12

Homework Assignment 13

Homework Assignment 14

Homework Assignment 15

Swearingen Engineering Center | Columbia, SC 29208 | 803.777.2880 | web@cse.sc.edu