exercisesFeb2208

exercisesFeb2208 - } /** * Given the row and column number,...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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!”
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
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 xs or all os //Check all columns //Check all rows //Check the two diagonals } }...
View Full Document

Page1 / 4

exercisesFeb2208 - } /** * Given the row and column number,...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online