|
||||
| |
||||
| |
||||
Lab Assignment 28(Thursday, 6 December 2007) Do program 13.10 on page 760 in your text. You can make the interface look however you want, but make sure it looks nice and professional. Figure 13-18 is just an example; you can make your program look like this or completely different as long as it looks good, makes sense, and functions. Don't use the becker.gui.FormLayout as a layout manager; use a standard Java layout manager like GrirdLayout, BorderLayout, etc., or just manually specify the positions of your components. Lab Assignment 26(Thursday, 29 November 2007) In this lab we will cover more graphics and drawing. Do number 6.18 on page 327 in your text. Lab Assignment 21(Thursday, 8 November 2007) This will be called a lab but in fact will be the "lab test". Lab Assignment 20(Tuesday, 6 November 2007) The text for this assignment is quite long and is on a separate page. Lab Assignment 19(Thursday, 1 November 2007) Today's lab will cover:
Do problem 8.6 in your text. Use an ArrayList as your collection class for part c. Lab Assignment 18(Tuesday, 30 October 2007) In today's lab we will practice throwing, catching, and handling exceptions. For this lab we will be extending Homework 6. You may use your own implementation, or click here. to download an example solution. You may have noticed in Homework 6 that when your TravelBot broke due to running out of fuel, your entire program stopped. This is because breakRobot throws an exception, which crashes the program if not caught. First, fix this problem by catching the exception in your main class. Handle it by printing an appropriate message to the console. Now, do some error checking elsewhere in your program. Throw Exceptions in the following situations:
All exceptions should be thrown in a TravelBot method, but caught in main (your driver). Throw the exception with a useful message, and print this message when you catch and process the exception. Use the Java Exception class. Lab Assignment 17(Thursday, 25 October 2007) In this lab you will get more practice with the String class, instance variables, and accessors/mutators. We'll also use a class variable. Do 7.15 in your text with the following modifications: Add a boolean class variable called twelveHour. Your getHour method and toString method should return the 12-hour version of the time if twelveHour is true, and the 24-hour version otherwise. Assume the time is always stored in the 24-hour version (i.e., you only use 12-hour time for getHour or toString, and even then you should only return it, not change the instance variable). In your driver you should instance multiple objects of Time for different time zones (Eastern, Pacific, GMT, etc). Change the mode (24-hour vs 12-hour) at least once. Lab Assignment 16(Tuesday, 23 October 2007) The text for this assignment is quite long and is on a separate page. Lab Assignment 15(Thursday, 18 October 2007) The text for this assignment is quite long and is on a separate page. Lab Assignment 14(Tuesday, 16 October 2007) The text for this assignment is quite long and is on a separate page. Lab Assignment 13(Tuesday, 9 October 2007) The lab can be found here. WARNING: If what you see on this web page is a lab assignment about proramming with arrays, then you're looking at last semester's assignment. The lab page will be updated early in the week of 9 October and the correct lab will then appear. NO LAB ON THURSDAY 11 OCTOBER DUE TO FALL BREAK.Lab Assignment 12(Thursday, 4 October 2007) This will be called a lab but in fact will be the "lab test". Lab Assignment 11(Tuesday, 2 October 2007) Objective: In this lab we will get some practice with nested flow of control. Do number 5.14 in your text. Create at least one example City (room) to test your robot on and turn this file in with your Houdini.java. Lab Assignment 10(Thursday, 27 September 2007) Objective: Learn to develop an algorithm using if and while statements. Do assignment 4.14 on page 210 of your text. Note for each function, the robot could start from ANYWHERE, above or below, to the right or left of the destination intersection. Think carefully about your algorithm and write it in pseudocode before trying to write it in Java. Lab Assignment 9(Tuesday, 25 September 2007) The text for this assignment is quite long and is on a separate page. You will need three "city" configurations that can be downloaded from cave1.txt, cave2.txt, and cave3.txt. Lab Assignment 8(Thursday, 20 September 2007) Objectives: In today's lab you will learn about
Program Specification: Develop a java Program PitfallRobot.java which will inherit the robot class. The PitfallRobots will be able to perform 3 new tasks: logJump(), waterJump(), and alligatorJump(). Three PitfallRobots will then maneuver their way through a course using the basic robot functions as well as the new functions that you developed. At the end of each of course is a gold coin that the PitfallRobot must pick up. Good Luck and beware of the alligators! For reference: You are expected to hard code the robot flow of control so as to avoid the various pitfalls along each of the three paths. The point of this exercise is to get (more) experience with algorithms and method calls, and not (yet) to worry about if statements and iterations. Sample Output: .
Lab Assignment 7(Tuesday, 18 September 2007) Objectives: Learn how to design and implement threaded algorithms. For this lab, we will focus on the concept of threads. Specifically, we should be thinking at a high level of how we can have several things happening concurrently in solving a problem and then converting the concurrency into code. Do problem 3.9 in the text. Upload your solution, both the .java and the .class files, to the dropbox at https://www.cse.sc.edu. Lab Assignment 6(Thursday, 13 September 2007) Objectives: Learn how to design and implement algorithms. For this lab we will really start concentrating on the concept of an algorithm. Specifically, we should be thinking at a high level of the steps we need to do to solve some problem before we actually implement our solution in code. Do problem 3.8 in the text. Both solutions you come up with should have some sort of reasoning or theory behind them. For example, maybe Karel prefers to take make as few turns as possible, or maybe he doesn't care about turns but wants to unload the maximum number of pins as early in his walk as possible... Whatever you choose to do make sure you explain why. Note that one way to write this program is to have Karel traverse all the intersections, but drop pins only at certain locations. This may well be conceptually simpler in terms of controlling the movement of the robot, but it's clearly not efficient because you will be traversing a number of places you know you won't be dropping pins on. The other basic approach is to traverse the least possible number of intersections. This will be faster (if efficiency is really important), but it will require a much more detailed understanding of the control of the robot. This is quite often the situation with real programs. Sometimes, in writing programs, one does the simple thing wherever possible, and then goes back one bottleneck at a time to improve efficiency. Lab Assignment 5(Tuesday, 11 September 2007) Objectives: Learn how to use inheritance. In today's lab we will continue to practice using inheritance. Do excercise 2.8 on page 109 in your textbook. After you've written the LeftDancer class, create a driver program with 2 robots: a LeftDancer called lefty and a normal Robot called norm. Place the bots in a City and call the move() method on both of them. Using comments in your program, explain in order the sequence of methods that are called when you call lefty.move();. Lab Assignment 4 -- Extending Classes(Thursday, 6 September 2007) Objectives: Learn how to write methods and extend classes. From Chapter 2 of your textbook, do problem 2.9 on page 109. Upload your solution, both the dot java and the dot class files, to the dropbox at https://www.cse.sc.edu. Lab Assignment 3Objectives: Learn how to write methods and threads. (Thursday, 30 August 2007) In today's lab we'll use the Wall object from the Robots API, and continue using Robot methods for moving around. You will need to use Eclipse and create a project and a class just like we did last lab. Refer to the instructions for the last lab if you don't remember how to do this. Do exercise 1.12 in your textbook on page 49. Make sure you understand how to get the walls facing in the right direction (i.e., if you place a wall at intersection 1,1 facing North, where will it show up?). The instructions ask you to guide the Robot around the group of walls counter-clockwise. After you do this, think about how you could go around clockwise...if you have time, try to do it. Make sure you are using good programming style, like proper indentation and good whitespace to make the code more readable. Lab Assignment 2(Tuesday, 28 August 2007) The text for this assignment is quite long and is on a separate page. Lab Assignment 1(Thursday, 23 August 2007) The text for this assignment is quite long and is on a separate page. |
|
|||




.