I'm really confused Junit test case Here is my code.
How can I do Junit test with this code?
package pieces;
import java.util.ArrayList;
import board.Board;
public class Knight extends Piece {
public Knight(int positionX, int positionY, boolean
isWhite) {
super("N", positionX, positionY,
isWhite);
}
@Override
public String getPossibleMoves() {
ArrayList<String>
possibleMoves = new ArrayList<>();
// check if squares where knight
can go are available for it
if(positionX - 2 >= 0 &&
positionY - 1 >= 0) {
if(Board.board[positionX - 2][positionY - 1] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX - 2,
positionY - 1));
}else {
if(Board.board[positionX - 2][positionY -
1].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX - 2,
positionY - 1));
}
}
}
if(positionX - 2 >= 0 &&
positionY + 1 < 8) {
if(Board.board[positionX - 2][positionY + 1] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX - 2,
positionY + 1));
}else {
if(Board.board[positionX - 2][positionY +
1].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX - 2,
positionY + 1));
}
}
}
if(positionX + 2 < 8 &&
positionY - 1 >= 0) {
if(Board.board[positionX + 2][positionY - 1] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX + 2,
positionY - 1));
}else {
if(Board.board[positionX + 2][positionY -
1].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX + 2,
positionY - 1));
}
}
}
if(positionX + 2 < 8 &&
positionY + 1 < 8) {
if(Board.board[positionX + 2][positionY + 1] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX + 2,
positionY + 1));
}else {
if(Board.board[positionX + 2][positionY +
1].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX + 2,
positionY + 1));
}
}
}
if(positionX - 1 >= 0 &&
positionY - 2 >= 0) {
if(Board.board[positionX - 1][positionY - 2] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX - 1,
positionY - 2));
}else {
if(Board.board[positionX - 1][positionY -
2].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX - 1,
positionY - 2));
}
}
}
if(positionX - 1 >= 0 &&
positionY + 2 < 8) {
if(Board.board[positionX - 1][positionY +2] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX - 1,
positionY + 2));
}else {
if(Board.board[positionX - 1][positionY +
2].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX - 1,
positionY + 2));
}
}
}
if(positionX + 1 < 8 &&
positionY - 2 >= 0) {
if(Board.board[positionX + 1][positionY - 2] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX + 1,
positionY - 2));
}else {
if(Board.board[positionX + 1][positionY -
2].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX + 1,
positionY - 2));
}
}
}
if(positionX + 1 < 8 &&
positionY + 2 < 8) {
if(Board.board[positionX + 1][positionY + 2] == null) {
possibleMoves.add(Board.positionToChessPosition(positionX + 1,
positionY + 2));
}else {
if(Board.board[positionX + 1][positionY +
2].isWhite() ^ isWhite) {
possibleMoves.add(Board.positionToChessPosition(positionX + 1,
positionY + 2));
}
}
}
String result = "";
if(!possibleMoves.isEmpty())
{
result +=
possibleMoves.get(0);
for(int i = 1; i
< possibleMoves.size(); i++) {
result += ", " + possibleMoves.get(i);
}
}
return result;
}
@Override
public String toString() {
return "N" +
Board.positionToChessPosition(positionX, positionY);
}
}
public abstract class Piece {
protected String name;
protected int positionX, positionY;
public boolean isWhite;
/**
* Constructor for piece
* @param positionX position x on the board
* @param positionY position y on the board
* @param isWhite white or black piece
*/
public Piece(String name, int positionX, int positionY, boolean isWhite) {
this.name = name;
this.positionX = positionX;
this.positionY = positionY;
this.isWhite = isWhite;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPositionX() {
return positionX;
}
public void setPositionX(int positionX) {
this.positionX = positionX;
}
public int getPositionY() {
return positionY;
}
public void setPositionY(int positionY) {
this.positionY = positionY;
}
public boolean isWhite() {
return isWhite;
}
public void setWhite(boolean isWhite) {
this.isWhite = isWhite;
}
/**
* This method will return string that is all legal moves for this piece
* @return string of chess squares on the board where piece can move
*/
public abstract String getPossibleMoves();
}
In: Computer Science
PLEASE USE PYTHON THANK YOU
In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes glaze over at the first mention of mathematics “wins $4”.
Your challenge is to write a program that demonstrates the futility of playing the game. Your Python program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty.
The program should have at least TWO functions (Input validation and Sum of the dots of user’s two dice). Like the program 1, your code should be user-friendly and able to handle all possible user input. The game should be able to allow a user to ply as many times as she/he wants.
The program should print a table as following:
Number of rolls Win or Loss Current value of the pot
0 Put $10
1 Win $14
2 Loss $13
3 Loss $12
## Loss $0
You lost your money after ## rolls of play.
The maximum amount of money in the pot during the playing is $##.
Do you want to play again?
At that point the player’s pot is empty (the Current value of the pot is zero), the program should display the number of rolls it took to break the player and the maximum amount of money in the pot during the playing.
Again, add good comments to your program.
Test your program with $5, $10 and $20.
In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes glaze over at the first mention of mathematics “wins $4”.
Your challenge is to write a program that demonstrates the futility of playing the game. Your Python program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty.
The program should have at least TWO functions (Input validation and Sum of the dots of user’s two dice). Like the program 1, your code should be user-friendly and able to handle all possible user input. The game should be able to allow a user to ply as many times as she/he wants.
The program should print a table as following:
Number of rolls Win or Loss Current value of the pot
0 Put $10
1 Win $14
2 Loss $13
3 Loss $12
## Loss $0
You lost your money after ## rolls of play.
The maximum amount of money in the pot during the playing is $##.
Do you want to play again?
At that point the player’s pot is empty (the Current value of the pot is zero), the program should display the number of rolls it took to break the player and the maximum amount of money in the pot during the playing.
Again, add good comments to your program.
Test your program with $5, $10 and $20.
In: Computer Science
Selected financial information gathered from the Matador Corporation follows:
|
Year 3 |
Year 2 |
Year 1 |
|
|
Average assets |
$1,007,000 |
$1,094,000 |
$1,184,000 |
|
Average equity |
$215,000 |
$294,000 |
$364,000 |
|
Return on assets |
5.9% |
6.6% |
7.2% |
|
Quick ratio |
0.3 |
0.5 |
0.6 |
|
Sales |
$1,650,000 |
$1,452,000 |
$1,304,000 |
|
Cost of goods sold |
$1,345,000 |
$1,176,000 |
$1,043,000 |
Using only the data presented, which of the following statements is most correct?
A. Leverage has declined.
B. Return on equity has improved.
C. Gross profit margin has improved.
In: Accounting
Consider the following time series.
| Quarter | Year 1 | Year 2 | Year 3 |
| 1 | 71 | 68 | 62 |
| 2 | 49 | 41 | 51 |
| 3 | 58 | 60 | 53 |
| 4 | 83 | 85 | 72 |
b. Use the following dummy variables to develop an estimated regression equation to account for seasonal effects in the data: Qtr1 = 1 if Quarter 1, 0 otherwise; Qtr2 = 1 if Quarter 2, 0 otherwise; Qtr3 = 1 if Quarter 3, 0 otherwise. Enter negative values as negative numbers.
Value = + Qtr1 + Qtr2 + Qtr3
c. Compute the quarterly forecasts for next year.
| Quarter 1 forecast | |
| Quarter 2 forecast | |
| Quarter 3 forecast | |
| Quarter 4 forecast |
In: Statistics and Probability
Consider the following time series:
| Quarter | Year 1 | Year 2 | Year 3 |
| 1 | 74 | 71 | 65 |
| 2 | 44 | 36 | 46 |
| 3 | 61 | 63 | 56 |
| 4 | 78 | 81 | 72 |
| Use a multiple linear regression model with dummy variables as follows to develop an equation to account for seasonal effects in the data: Qtr1 = 1 if quarter 1, 0 otherwise; Qtr2 = 1 if quarter 2, 0 otherwise; Qtr3 = 1 if quarter 3, 0 otherwise. For subtractive or negative numbers use a minus sign even if there is a + sign before the blank. (Example: -300) | ||||||||||||||||
| ŷ = + Qtr1 + Qtr2 + Qtr3 | ||||||||||||||||
| (c) | Compute the quarterly forecasts for next year. | |||||||||||||||
|
In: Statistics and Probability
Consider the following time series data.
| Quarter | Year 1 | Year 2 | Year 3 |
| 1 | 2 | 4 | 5 |
| 2 | 4 | 5 | 8 |
| 3 | 1 | 3 | 4 |
| 4 | 7 | 9 | 10 |
| (a) | Choose the correct time series plot. | ||||||||||||||||||||
|
|||||||||||||||||||||
| - Select your answer -Plot (i)Plot (ii)Plot (iii)Plot (iv)Item 1 | |||||||||||||||||||||
| What type of pattern exists in the data? | |||||||||||||||||||||
| - Select your answer -Positive trend pattern, no seasonalityHorizontal pattern, no seasonalityNegative trend pattern, no seasonalityPositive trend pattern, with seasonalityHorizontal pattern, with seasonalityItem 2 | |||||||||||||||||||||
| (b) | Use a multiple regression model with dummy variables as follows to develop an equation to account for seasonal effects in the data. Qtr1 = 1 if Quarter 1, 0 otherwise; Qtr2 = 1 if Quarter 2, 0 otherwise; Qtr3 = 1 if Quarter 3, 0 otherwise. | ||||||||||||||||||||
| If required, round your answers to three decimal places. For subtractive or negative numbers use a minus sign even if there is a + sign before the blank. (Example: -300) If the constant is "1" it must be entered in the box. Do not round intermediate calculation. | |||||||||||||||||||||
| ŷ = + Qtr1 + Qtr2 + Qtr3 | |||||||||||||||||||||
| (c) | Compute the quarterly forecasts for next year based on the model you developed in part (b). | ||||||||||||||||||||
| If required, round your answers to three decimal places. Do not round intermediate calculation. | |||||||||||||||||||||
|
|||||||||||||||||||||
| (d) | Use a multiple regression model to develop an equation to account for trend and seasonal effects in the data. Use the dummy variables you developed in part (b) to capture seasonal effects and create a variable t such that t = 1 for Quarter 1 in Year 1, t = 2 for Quarter 2 in Year 1,… t = 12 for Quarter 4 in Year 3. | ||||||||||||||||||||
| If required, round your answers to three decimal places. For subtractive or negative numbers use a minus sign even if there is a + sign before the blank. (Example: -300) | |||||||||||||||||||||
| ŷ = + Qtr1 + Qtr2 + Qtr3 + t | |||||||||||||||||||||
| (e) | Compute the quarterly forecasts for next year based on the model you developed in part (d). | ||||||||||||||||||||
| Do not round your interim computations and round your final answer to three decimal places. | |||||||||||||||||||||
|
|||||||||||||||||||||
| (f) | Is the model you developed in part (b) or the model you developed in part (d) more effective? | ||||||||||||||||||||
| If required, round your intermediate calculations and final answer to three decimal places. | |||||||||||||||||||||
|
|||||||||||||||||||||
| - Select your answer -Model developed in part (b)Model developed in part (d)Item 22 | |||||||||||||||||||||
| Justify your answer. |
In: Statistics and Probability
Consider the following time series data.
| Quarter | Year 1 | Year 2 | Year 3 |
| 1 | 2 | 5 | 7 |
| 2 | 0 | 2 | 6 |
| 3 | 5 | 8 | 10 |
| 4 | 5 | 8 | 10 |
| b) | Use a multiple regression model with dummy variables as follows to develop an equation to account for seasonal effects in the data. Qtr1 = 1 if Quarter 1, 0 otherwise; Qtr2 = 1 if Quarter 2, 0 otherwise; Qtr3 = 1 if Quarter 3, 0 otherwise. | ||||||||||||||||||||
| If required, round your answers to three decimal places. For subtractive or negative numbers use a minus sign even if there is a + sign before the blank. (Example: -300) If the constant is "1" it must be entered in the box. Do not round intermediate calculation. | |||||||||||||||||||||
| ŷ = + Qtr1 + Qtr2 + Qtr3 | |||||||||||||||||||||
| (c) | Compute the quarterly forecasts for next year based on the model you developed in part (b). | ||||||||||||||||||||
| If required, round your answers to three decimal places. Do not round intermediate calculation. | |||||||||||||||||||||
|
|||||||||||||||||||||
| (d) | Use a multiple regression model to develop an equation to account for trend and seasonal effects in the data. Use the dummy variables you developed in part (b) to capture seasonal effects and create a variable tsuch that t = 1 for Quarter 1 in Year 1, t = 2 for Quarter 2 in Year 1,… t = 12 for Quarter 4 in Year 3. | ||||||||||||||||||||
| If required, round your answers to three decimal places. For subtractive or negative numbers use a minus sign even if there is a + sign before the blank. (Example: -300) | |||||||||||||||||||||
| ŷ = + Qtr1 + Qtr2 + Qtr3 + t | |||||||||||||||||||||
| (e) | Compute the quarterly forecasts for next year based on the model you developed in part (d). | ||||||||||||||||||||
| Do not round your interim computations and round your final answer to three decimal places. | |||||||||||||||||||||
|
|||||||||||||||||||||
| (f) | Is the model you developed in part (b) or the model you developed in part (d) more effective? | ||||||||||||||||||||
| If required, round your intermediate calculations and final answer to three decimal places. | |||||||||||||||||||||
|
|||||||||||||||||||||
| - Select your answer -Model developed in part (b)Model developed in part (d)Item 22 | |||||||||||||||||||||
| Justify your answer. | |||||||||||||||||||||
| The input in the box below will not be graded, but may be reviewed and considered by your instructor. |
Please show steps to solve using Excel.
In: Statistics and Probability
Investiment opportuity as folows: Year 0, unknown cash flow, Year 1 = 200 cash flos,,Year 2 = 400 cash flow, Year 3 = -100 cash flow, year 4= 500 cash flow, Year 5 = 200 cash flow
a. If other investments with comparble risk are earning 12% then how mudh shoud you be willing to pay for this investment?
If you purchace it for 800 then what is the anual rate of retun on the investment?
In: Finance
Consider the following time series.
| Quarter | Year 1 | Year 2 | Year 3 |
|---|---|---|---|
| 1 | 70 | 67 | 61 |
| 2 | 48 | 40 | 50 |
| 3 | 58 | 60 | 53 |
| 4 | 79 | 82 | 73 |
(b)Use the following dummy variables to develop an estimated regression equation to account for seasonal effects in the data:
x1 = 1 if quarter 1, 0 otherwise; x2 = 1 if quarter 2, 0 otherwise; x3 = 1 if quarter 3, 0 otherwise.
=
(c)Compute the quarterly forecasts for next year.
quarter 1 forecast___
quarter 2 forecast___
quarter 3 forecast___
quarter 4 forecast___
In: Statistics and Probability
Consider the following time series data.
| Quarter | Year 1 | Year 2 | Year 3 |
| 1 | 5 | 8 | 10 |
| 2 | 2 | 4 | 8 |
| 3 | 1 | 4 | 6 |
| 4 | 3 | 6 | 8 |
A.) Use a multiple regression model with dummy variables as
follows to develop an equation to account for seasonal effects in
the data. Qtr1 = 1 if Quarter 1, 0 otherwise; Qtr2 = 1 if Quarter
2, 0 otherwise; Qtr3 = 1 if Quarter 3, 0 otherwise. If required,
round your answers to three decimal places. For subtractive or
negative numbers use a minus sign even if there is a + sign before
the blank. (Example: -300) If the constant is "1" it must be
entered in the box. Do not round intermediate calculation.
|
| B.)Use a multiple regression model to develop an equation to account for trend and seasonal effects in the data. Use the dummy variables you developed in part (a) to capture seasonal effects and create a variable t such that t = 1 for Quarter 1 in Year 1, t = 2 for Quarter 2 in Year 1,… t = 12 for Quarter 4 in Year 3. | |
If required, round your answers to three decimal places. For
subtractive or negative numbers use a minus sign even if there is a
+ sign before the blank. (Example: -300)
|
C.) Is the model you developed in part (a) or the model you
developed in part (b) more effective? If required, round your
intermediate calculations and final answer to three decimal places.
|
D.) Justify your answer
In: Statistics and Probability