0% found this document useful (0 votes)
2 views3 pages

(Key) Csa U8l1 Project Planning Extra Practice

The document includes exercises for understanding recursive methods and ArrayList manipulation in Java. It also outlines a project planning task for developing a chess game, detailing system requirements and providing an example prioritized list of development tasks. The content is structured for educational purposes, focusing on programming concepts and project management.

Uploaded by

Zeyna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

(Key) Csa U8l1 Project Planning Extra Practice

The document includes exercises for understanding recursive methods and ArrayList manipulation in Java. It also outlines a project planning task for developing a chess game, detailing system requirements and providing an example prioritized list of development tasks. The content is structured for educational purposes, focusing on programming concepts and project management.

Uploaded by

Zeyna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSA Unit 8 Lesson 1

Name(s) __________________________________________________ Period _______ Date _____________________

[KEY] Extra Practice - Project Planning

Check for Understanding

Consider the following method:

public String mystery(String myString, int index) {


if (index >= myString.length()) {
return myString;
}

return myString + mystery(myString.substring(index), index + 2);
}

What is printed as a result of executing the following line of code?

System.out.println(mystery("CSA is the best!", 0));

A. CSA is the best!

B. CSA is the best!CSA is the best!A is the best! the best!est!

C. CSA is the best! A is the best! The best! est! est!

D. CSA is the best!A is the best! The best!est!

E. CSA is the best!A is the best! The best!

1
AP Exam Prep

The following code segment is intended to return the location of a target element in an ArrayList.

public static int findLocation(ArrayList<Integer> numbers, int target) {


for (int index = 0; index < numbers.size(); index++) {
if (numbers.get(index) == target) {
return index;
}
}
return -1;
}

Which of the following conditions will cause the given code segment to not work as intended?

A. The ArrayList contains null elements.

B. The ArrayList is not sorted in ascending order.

C. The ArrayList contains duplicate elements.

D. The size of the ArrayList is less than the expected number of elements.

E. The ArrayList is not initialized with an initial capacity.

2
Extra Practice

Do This: Based on the system requirements below, create a prioritized list of the first 8 items needed to be
developed to create a chess game.

Chess Game System Requirements:

●​ The game is a two-player game.


●​ Each player is randomly assigned a color, black or white.
●​ The player assigned the color white plays the first move.
●​ Each player makes a move after their opposing player.
●​ The game is played on a checkered game board with 64 squares arranged in an 8×8 grid.
●​ Each side starts off with 8 pawns, 2 rooks, 2 bishops, 2 knights, 1 queen, and 1 king.
●​ The game can end in a checkmate from one side, forfeit, or resignation.
●​ All rules of international chess will be followed.

Student responses will vary. Example:

Prioritized List:

1.​ Create a UML diagram to outline the attributes and methods needed in the
system.

2.​ Develop the Game class (i.e. the game engine for the chess game) - This class
will control the flow of the game and keep track of the state of the game,
including turns, moves, and final results of the game.

3.​ Develop a Square class - Each Square will represent one of the 64 squares on
the game board and will keep track of what pieces are actively positioned on it.

4.​ Develop the Board class - Board will contain 64 Square instances to represent
the 64 spaces on the game board.

5.​ Develop the Player class. - This class will store information pertaining to the
participant of the game.

6.​ Develop the Piece class. - This class will be used to represent the pieces on the
game board. It will encapsulate any shared behaviors between the 8 pieces and
will likely serve as a superclass.

7.​ Develop subclasses for each piece. - For each piece type on the gameboard,
create a class that inherits from the Pieces class.

8.​ Create a Move class or move() methods - This will represent a move in the
game and will validate if a selected move is valid or captures a piece.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy