exercisesFeb2208

# exercisesFeb2208 - Given the row and column number return...

This preview shows pages 1–4. Sign up to view the full content.

COMP202 Section 3: Ladan Mahabadi February 22, 2008 Marks: Continuing with our marks example (from the lecture notes), add the following features to your code: Find the student with the lowest grade Find the student with the highest grade

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Linear Search: Write a program creates an array of size 50, places random integers between 2 – 52 in each array cell and then searches the array for a user given value and displays the index where the value is stored and otherwise displays “Not Found!”
Tic-Tac-Toe import java.util.*; public class tGame { //Three rows of the game private char[] firstRow, secondRow, thirdRow; // Constructor public tGame() { //Initially, the board is empty: Place a random character (say 0s) in all cells

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } /** * Given the row and column number, return the character stored in that cell **/ public char getContent(int row, int col) { } /** * Given the row and column number, update the content of that cell * to xOrO **/ public void setContent(int row, int col, char xOrO) { } /** * A method that displays the content of the board **/ public void print() { } /** * A method that checks whether or not the board's filled with X/O **/ public boolean full() { } /** * A method that checks whether or not the game has been won **/ public boolean won() { // Game's won if one of the columns, rows, or diagonals contains all x’s or all o’s //Check all columns //Check all rows //Check the two diagonals } }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

exercisesFeb2208 - Given the row and column number return...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online