Programming Assignment 9
Due: Week of Mar. 27 before lab
-
(25 points) Sudoku. Write a function to verify a solution to a
Sudoku puzzle. It must
contain the following header:
public static boolean verifySudoku(int[][] solution);
Write a client program that takes a filename as a command-line argument, whose contents represent a solution to a sudoku puzzle, and output whether the solution is correct. You can assume the files contents always contain 81 numbers whose values are between 1 and 9.- Name the file and program
Sudoku.java
. - Example files: sudoku1.txt and sudoku2.txt
- Example execution (
java Sudoku sudoku1.txt
):
The solution contained within 'sudoku1.txt' is correct. - Example execution (
java Sudoku sudoku2.txt
):
The solution contained within 'sudoku2.txt' is incorrect.
- Name the file and program
- (50 points) Write a description of an object-oriented framework. You can choose anything you would like, except for the aquarium and the world of Harry Potter as was discussed in class. You need at least four objects interacting with each other. Provide both a written description (typed, one paragraph per object with one paragraph overview) and a UML diagram (computer generated, not hand drawn!). Be sure to include correct notations for aggregation and composition in the diagram.
-
(25 points) This course has a final programming project. It should revolve
around an interactive program or simple game (be visual), involve both file
input and output, and be composed of at least 3 objects. A good example
would be a version of Guitar Hero for the keyboard. In this you would read a
song from a file (series of buttons needing to be pressed not an actual
song), then have the person press each of the buttons to win the game, and
finally write a set of statistics to a file.
- Describe your topic, the visual display, file I/O involved, and major objects comprising your project.
- If you decide to do the project with a partner - (a) each of you must have this paragraph written in your own words and (b) list the name of your partner clearly
-
Bonus.
(20 points) Maze solver.
Write a program that takes a single filename as a command-line argument,
whose contents represent a maze, and determine whether or not a path exists.
If a path exists, output one possible solution to the maze. The first line
of the file defines the size of an
N x M
matrix. The rest of the contents are characters: 's' is the start, 'g' is the goal, 'x' is an obstacle, and '.' is an empty cell. Solve this problem with a recursive function. When outputting the solution, show the entire maze with all of the '.'s replaced with 'p' if they lie along your solution path. You may assume the contents of the file are always correct.- Name the file and program
MazeSolver.java
. - Example files: maze1.txt and maze2.txt
- Example execution (
java MazeSolver maze1.txt
):
Solution path exists
. x . x p p p p p
. . . x g x x x p
x . x . x . . . p
x s p p p x x x p
. . x x p p p p p - Example execution (
java MazeSolver maze2.txt
):
Solution path does not exist
- Name the file and program
General Instructions, Turning in assignments, and Grading
General Instructions
- Name each file and program as listed in the instructions.
- The top of each program should have a comment block where the first line
is your name and following lines are a description of your program.
//Name: Jory Denny
//This program debates Batman vs Superman! - Use proper coding style (described more in Grading below)
- Follow turn-in instructions precisely.
- Failure to complete any of these steps will result in a significant loss of points.
Turn in Instructions
Each assignment will be turned in to both Blackboard (soft copy) and in class (hard copy). Assignments are due BEFORE, let me repeat, before class starts. This does not mean five minutes after class starts.
- Soft copy (Online submission)
- Create a compressed
.zip
file of all Java programs needed to compile your program and all input files (if needed) to run your program.- If you do not know how to create a compressed
.zip
file, there is this cool new website you can use to search for instructions by entering"How to create .zip Windows 10"
or"How to create .zip MAC OSX"
for example.
- If you do not know how to create a compressed
- Submit
.zip
file on Blackboard by the stated due date and time.
- Create a compressed
- Hard copy (In-class submission)
- The first page of your hard copy must be a signed coverpage.
- Next put the programs in order as described in the description.
- If you do not know how to print a java file, there is this cool
new website you can use to
search for instructions by entering
"How to open and print .java file Windows 10"
or"How to open and print .java file MAC OSX"
for example. In combination with this, you may have to consult University of Richmond webpages to learn how to use campus printers. I recommend printing directly from sublime text editor on University computers (has printing feature enabled) and will print with syntax-highlighting (colors).
- If you do not know how to print a java file, there is this cool
new website you can use to
search for instructions by entering
- Staple all pages together.
- Turn in packet before class begins.
- I reserve the right to assign a 0 to any assignment failing to comply with these instructions. Even for something as small as a missing staple.
Points
- Each assignment is graded out of 100 points (not including bonus).
- Criteria and point distribution
- If the code is not named precisely or does not compile, -75% on a problem.
- If the code does not generate the correct output, -50% on a problem.
- Following instructions and algorithm used to solve, 25% on a problem. Following instructions is extremely important in computer science, train yourself to think like a computer. There are many ways to solve a problem, some may be better or worse than others.
- Stylistic elements of written code,
25% of a problem. Style includes (but is not
limited to):
- Descriptive comments on intent and purpose of code
- Descriptive and consistant naming conventions
- Indenting properly (after an opening brace, tab right by 1 indent; after a closing brace, tab left by 1 indent)
- Consistent spacing
- Consistent bracket placement (same line or on new line)
- Avoiding code duplication
- If there are any discrepencies in grades please see the instructor during his office hours or by appointment (do not discuss with the lab assistants or graders).