introduction to object oriented programming 3

more information it’s will help you also in homework

public class BishopMoves {_x000D_
	public static int numBishopMoves(String square) {_x000D_
		square.toUpperCase();_x000D_
		_x000D_
		// Convert from uppercase letter to integer representation of column _x000D_
		// number_x000D_
		int col = square.charAt(0) - 64;_x000D_
		// Convert from character to integer representation of row number_x000D_
		int row = square.charAt(1) - 48;_x000D_
		_x000D_
		int numMoves = 0;_x000D_
		for (int newCol = 1; newCol < 8; newCol++) {_x000D_
			int offset = newCol - col;_x000D_
			_x000D_
			int newRowAbove = row + offset;_x000D_
			if (newRowAbove >= 1 && newRowAbove <= 8) {_x000D_
				numMoves++;_x000D_
				System.out.println((char) (newCol+64) _x000D_
						+ (char) (newRowAbove+48));_x000D_
			}_x000D_
			_x000D_
			int newRowBelow = row - offset;_x000D_
			if (newRowBelow >= 1 && newRowBelow <= 8) {_x000D_
				numMoves++;_x000D_
				System.out.println((char) (newCol+64) _x000D_
						+ (char) (newRowBelow+48));_x000D_
			}_x000D_
		}_x000D_
		_x000D_
		return numMoves;_x000D_
	}_x000D_
}

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.


The post introduction to object oriented programming 3 appeared first on Custom Nursing Help.

 

"Are you looking for this answer? We can Help click Order Now"