You will write a multi-interface version of the well-known concentration game: 1. The game
displays a grid of upper-case letters, with each letter appearing twice. 2. A player has a few
seconds to memorize the letters before they disappear. 3. The player then has to remember where
each pair was located.
line, then MultiConcentration starts with the text interface.
First the new game display will show the user the pairs he/she must guess, in a format similar to
the following example for size = 6
D H B C M I
H G K K A R
C N R E O E
Q O A Q L F
L F J P B G
P D N M I J
Memorize the above grid!
Note that the new game display uses pairs of distinct single uppercase capital letters distributed
at random on a square grid, starting at A and continuing until the grid is full.
This new game display shows for 10 seconds, after which it scrolls out of view. (To scroll it just
write about 25 newlines.) Then the standard game display appears.
The standard game display will look like the following example for size = 6
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
21 32 33 34 35 36
Enter a pair of numbers, or \"R\" to reset, or \"Q\" to quit:
reset, or \"Q\" to quit:
If the player makes an invalid entry (e.g. numbers out of range, number already guessed, no
blank separator, etc.) then a \"please reenter\" message is printed and the same display is shown
again.
If the player makes a bad guess, then a \"Sorry...\" message is printed and the same display is
shown again.
If the player enters an \"R\" for reset, then we start over, that is, the computer calculates a new
set of pairs and shows the new game display again.
If the player enters a \"Q\" for quit, then the game prints a \"Game Over\" message and ends.
3.4 Graphic Game Interface
If the player used the \"-g\" flag on the startup command line then MultiConcentration starts up
with the graphic interface.
You may design the graphic interface as you choose, as long as you use Swing and preserve the
steps in the game as described in the previous section.
One possible graphic interface is shown in Figure 1. In this design the new game display and the
standard game display have been replaced by a grid of buttons. Instead of entering pairs of
numbers, the player clicks on two of the buttons. The \"reset\" and \"quit\" commands are given
using a menu. Letters that have been correctly guessed are shown with a pink background color.
Messages to the player are shown in a text area under the grid.
4 GENERAL REQUIREMENTS
4.1 Design Requirements
Design your program with GUI classes, a main class, and Application Logic / Data classes as
described in my overheads on Design for Testability.
Do not use a package statement; name the main class MultiConcentration. (Otherwise the
startup command given in 3.1 would not work.)
You should have at least 5 classes, and not one of them should have more than 40% of the code.
Solution
import java.io.OutputStream;
import java.io.PrintStream;
public cl.
Please help with this. program must be written in C# .. All of the g.pdfmanjan6
Please help with this. program must be written in C# .. All of the game logic must be written in a
seperate class using using an array that is passed in through a prperty that represents the game
board. The class needs to have methods to determine of someone won, or if there was a tie,
make sure all business logic is in a seperate class anot behind the UI..
***** These are the complete in instructions for the game assignment design
Create a Tic-Tac-Toe game that can be played by two players. The form will consist of a Tic-
Tac-Toe board in which the users’ click on to choose their space. As the game is being played
the Game Status section will tell whose turn it is. When someone wins or there is a tie, a message
will be displayed in the Game status section telling the users the status. When someone wins the
game the winning move needs to be indicated. There also needs to be a section that keeps track
of the number of wins for each player, and the number of ties. When the game is finished the
user may click the “Start Game” button to start a new game.
This program will consist of the main form and at least one class that will define the rules of the
game. This class will have an array that is passed in through a property that represents the game
board. The class will then have methods within it that determines if someone won, if there is a
tie, or if neither has occurred yet. Make sure all business logic is in a separate class and not
behind the UI.
EXTRA CREDIT (10 Points)
Create a computer player that can be played against. The computer player will need to be smart
enough to make a winning move or to block a winning move.
Solution
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Tic_Tac_Toe
{
///
/// Description of MainForm.
///
public partial class MainForm : Form
{
Logic logicObj = new Logic();
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
int turn=1;
int click1=0,click2=0,click3=0,click4=0,click5=0,click6=0,click7=0,click8=0,click9=0;
int player1=0,player2=0;
void Button1Click(object sender, EventArgs e)
{
if(click1==0)
{
if(turn%2!=0)
{
button1.Text=\"X\";
click1++;
}
else
{
button1.Text=\"O\";
click1++;
}
turn++;
}
else
{
button1.Text=button1.Text;
}
display();
int a = logicObj.winLossFunc(button1.Text, button2.Text, button3.Text, button4.Text,
button5.Text, button6.Text, button7.Text, button8.Text, button9.Text);
if (a==1)
{
player1++;
player1score.Text = player1.ToString();
cleargame();
}
else if(a==2)
{
player2++;
player2score.Text = player2.ToString();
cleargame();
}
}
void Button2Click(object sender, EventArgs e)
{
if(click2==0)
{
if(turn%2!=0)
{
button2.Text=\"X\";
click2++;
}
else
{
button2.Text=\"O\";
click2++;
}
turn++;
}
else
{
button2.Text=button2.Text;
}
display();
int a = logicObj.winLossFunc(button1.Text, b.
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
Working with Layout Managers. Notes: 1. In part 2, note that the Game class inherits from
JPanel. Therefore, the panel you are asked to add to the center of the content pane is the \"game\"
object. 2. In part 4, at the end of the function, call validate(). This is not mentioned in the book,
but it is mentioned in the framework comments.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Game extends JPanel
{
private JButton [][] squares;
private TilePuzzle game;
public Game( int newSide )
{
game = new TilePuzzle( newSide );
setUpGameGUI( );
}
public void setUpGame( int newSide )
{
game.setUpGame( newSide );
setUpGameGUI( );
}
public void setUpGameGUI( )
{
removeAll( ); // remove all components
setLayout( new GridLayout( game.getSide( ),
game.getSide( ) ) );
squares = new JButton[game.getSide( )][game.getSide( )];
ButtonHandler bh = new ButtonHandler( );
// for each button: generate button label,
// instantiate button, add to container,
// and register listener
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j] = new JButton( game.getTiles( )[i][j] );
add( squares[i][j] );
squares[i][j].addActionListener( bh );
}
}
setSize( 300, 300 );
setVisible( true );
}
private void update( int row, int col )
{
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j].setText( game.getTiles( )[i][j] );
}
}
if ( game.won( ) )
{
JOptionPane.showMessageDialog( Game.this,
\"Congratulations! You won!\ Setting up new game\" );
// int sideOfPuzzle = 3 + (int) ( 4 * Math.random( ) );
// setUpGameGUI( );
}
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent ae )
{
for( int i = 0; i < game.getSide( ); i++ )
{
for( int j = 0; j < game.getSide( ); j++ )
{
if ( ae.getSource( ) == squares[i][j] )
{
if ( game.tryToPlay( i, j ) )
update( i, j );
return;
} // end if
} // end inner for loop
} // outer for loop
} // end actionPerformed method
} // end ButtonHandler class
} // end Game class
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NestedLayoutPractice extends JFrame
{
private Container contents;
private Game game;
private BorderLayout bl;
private JLabel bottom;
// ***** Task 1: declare a JPanel named top
// also declare three JButton instance variables
// that will be added to the JPanel top
// these buttons will determine the grid size of the game:
// 3-by-3, 4-by-4, or 5-by-5
// Part 1 student code starts here:
// Part 1 student code ends here.
public NestedLayoutPractice()
{
super(\"Practicing layout managers\");
contents = getContentPane();
// ***** Task 2:
// instantiate the BorderLayout manager bl
// Part 2 student code starts here:
// set the layout manager of the content pane contents to bl:
game = new Game(3); // instantiating the GamePanel object
// add panel (game) to the center of the content pane
// Part 2 student code ends here.
bottom = new JLabel(.
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfanjandavid
In Java using Eclipse, I\'m suppose to write a class that encapsulates a tic tac toe board using two
dimensional arrays. It should only involve the human player vs. the computer, and should
randomly select who should use \'X\' or \'O\' and whether the human player or the computer
should go first. Verify that all moves by the human player are to a valid space on the tic-tac-toe
board, and an incorrect choice should not halt or terminate the game. Below is my Java program
that is currently a work in progress. Can you help me remodify it? Thanks.
import java.util.Scanner;
public class LeavinesTicTacToe
{
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args)
{
final int SIZE = 3;
char[][] board = new char[SIZE][SIZE]; // game board
resetBoard(board); // initialize the board (with \' \' for all cells)
// First, welcome message and display the board.
System.out.println(\"===== WELCOME TO THE TIC-TAC-TOE GAME!! =====\ \");
showBoard(board);
// Then ask the user which symbol (x or o) he/she wants to play.
System.out.print(\" Which symbol do you want to play, \\\"x\\\" or \\\"o\\\"? \");
char userSymbol = sc.next().toLowerCase().charAt(0);
char compSymbol = (userSymbol == \'x\') ? \'o\' : \'x\';
// Also ask whether or not the user wants to go first.
System.out.println();
System.out.print(\" Do you want to go first (y/n)? \");
char ans = sc.next().toLowerCase().charAt(0);
int turn; // 0 -- the user, 1 -- the computer
int remainCount = SIZE * SIZE; // empty cell count
// THE VERY FIRST MOVE.
if (ans == \'y\') {
turn = 0;
userPlay(board, userSymbol); // user puts his/her first tic
}
else {
turn = 1;
compPlay(board, compSymbol); // computer puts its first tic
}
// Show the board, and decrement the count of remaining cells.
showBoard(board);
remainCount--;
// Play the game until either one wins.
boolean done = false;
int winner = -1; // 0 -- the user, 1 -- the computer, -1 -- draw
while (!done && remainCount > 0) {
// If there is a winner at this time, set the winner and the done flag to true.
done = isGameWon(board, turn, userSymbol, compSymbol); // Did the turn won?
if (done)
winner = turn; // the one who made the last move won the game
else {
// No winner yet. Find the next turn and play.
turn = (turn + 1 ) % 2;
if (turn == 0)
userPlay(board, userSymbol);
else
compPlay(board, compSymbol);
// Show the board after one tic, and decrement the rem count.
showBoard(board);
remainCount--;
}
}
// Winner is found. Declare the winner.
if (winner == 0)
System.out.println(\"\ ** YOU WON. CONGRATULATIONS!! **\");
else if (winner == 1)
System.out.println(\"\ ** YOU LOST.. Maybe next time :) **\");
else
System.out.println(\"\ ** DRAW... **\");
}
public static void resetBoard(char[][] brd)
{
for (int i = 0; i < brd.length; i++)
for (int j = 0; j < brd[0].length; j++)
brd[i][j] = \' \';
}
public static void showBoard(char[][] brd)
{
int numRow = brd.length;
int numCol = brd[0].length;
System.out.println();
// First write the column he.
In this lesson you will learn how to use basic syntax, conditions, if-else statements and loops (for-loop, while-loop and do-while-loop) in Java and how to use the debugger.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-basic-syntax-conditions-and-loops
Please help with this. program must be written in C# .. All of the g.pdfmanjan6
Please help with this. program must be written in C# .. All of the game logic must be written in a
seperate class using using an array that is passed in through a prperty that represents the game
board. The class needs to have methods to determine of someone won, or if there was a tie,
make sure all business logic is in a seperate class anot behind the UI..
***** These are the complete in instructions for the game assignment design
Create a Tic-Tac-Toe game that can be played by two players. The form will consist of a Tic-
Tac-Toe board in which the users’ click on to choose their space. As the game is being played
the Game Status section will tell whose turn it is. When someone wins or there is a tie, a message
will be displayed in the Game status section telling the users the status. When someone wins the
game the winning move needs to be indicated. There also needs to be a section that keeps track
of the number of wins for each player, and the number of ties. When the game is finished the
user may click the “Start Game” button to start a new game.
This program will consist of the main form and at least one class that will define the rules of the
game. This class will have an array that is passed in through a property that represents the game
board. The class will then have methods within it that determines if someone won, if there is a
tie, or if neither has occurred yet. Make sure all business logic is in a separate class and not
behind the UI.
EXTRA CREDIT (10 Points)
Create a computer player that can be played against. The computer player will need to be smart
enough to make a winning move or to block a winning move.
Solution
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Tic_Tac_Toe
{
///
/// Description of MainForm.
///
public partial class MainForm : Form
{
Logic logicObj = new Logic();
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
int turn=1;
int click1=0,click2=0,click3=0,click4=0,click5=0,click6=0,click7=0,click8=0,click9=0;
int player1=0,player2=0;
void Button1Click(object sender, EventArgs e)
{
if(click1==0)
{
if(turn%2!=0)
{
button1.Text=\"X\";
click1++;
}
else
{
button1.Text=\"O\";
click1++;
}
turn++;
}
else
{
button1.Text=button1.Text;
}
display();
int a = logicObj.winLossFunc(button1.Text, button2.Text, button3.Text, button4.Text,
button5.Text, button6.Text, button7.Text, button8.Text, button9.Text);
if (a==1)
{
player1++;
player1score.Text = player1.ToString();
cleargame();
}
else if(a==2)
{
player2++;
player2score.Text = player2.ToString();
cleargame();
}
}
void Button2Click(object sender, EventArgs e)
{
if(click2==0)
{
if(turn%2!=0)
{
button2.Text=\"X\";
click2++;
}
else
{
button2.Text=\"O\";
click2++;
}
turn++;
}
else
{
button2.Text=button2.Text;
}
display();
int a = logicObj.winLossFunc(button1.Text, b.
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
Working with Layout Managers. Notes: 1. In part 2, note that the Game class inherits from
JPanel. Therefore, the panel you are asked to add to the center of the content pane is the \"game\"
object. 2. In part 4, at the end of the function, call validate(). This is not mentioned in the book,
but it is mentioned in the framework comments.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Game extends JPanel
{
private JButton [][] squares;
private TilePuzzle game;
public Game( int newSide )
{
game = new TilePuzzle( newSide );
setUpGameGUI( );
}
public void setUpGame( int newSide )
{
game.setUpGame( newSide );
setUpGameGUI( );
}
public void setUpGameGUI( )
{
removeAll( ); // remove all components
setLayout( new GridLayout( game.getSide( ),
game.getSide( ) ) );
squares = new JButton[game.getSide( )][game.getSide( )];
ButtonHandler bh = new ButtonHandler( );
// for each button: generate button label,
// instantiate button, add to container,
// and register listener
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j] = new JButton( game.getTiles( )[i][j] );
add( squares[i][j] );
squares[i][j].addActionListener( bh );
}
}
setSize( 300, 300 );
setVisible( true );
}
private void update( int row, int col )
{
for ( int i = 0; i < game.getSide( ); i++ )
{
for ( int j = 0; j < game.getSide( ); j++ )
{
squares[i][j].setText( game.getTiles( )[i][j] );
}
}
if ( game.won( ) )
{
JOptionPane.showMessageDialog( Game.this,
\"Congratulations! You won!\ Setting up new game\" );
// int sideOfPuzzle = 3 + (int) ( 4 * Math.random( ) );
// setUpGameGUI( );
}
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent ae )
{
for( int i = 0; i < game.getSide( ); i++ )
{
for( int j = 0; j < game.getSide( ); j++ )
{
if ( ae.getSource( ) == squares[i][j] )
{
if ( game.tryToPlay( i, j ) )
update( i, j );
return;
} // end if
} // end inner for loop
} // outer for loop
} // end actionPerformed method
} // end ButtonHandler class
} // end Game class
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class NestedLayoutPractice extends JFrame
{
private Container contents;
private Game game;
private BorderLayout bl;
private JLabel bottom;
// ***** Task 1: declare a JPanel named top
// also declare three JButton instance variables
// that will be added to the JPanel top
// these buttons will determine the grid size of the game:
// 3-by-3, 4-by-4, or 5-by-5
// Part 1 student code starts here:
// Part 1 student code ends here.
public NestedLayoutPractice()
{
super(\"Practicing layout managers\");
contents = getContentPane();
// ***** Task 2:
// instantiate the BorderLayout manager bl
// Part 2 student code starts here:
// set the layout manager of the content pane contents to bl:
game = new Game(3); // instantiating the GamePanel object
// add panel (game) to the center of the content pane
// Part 2 student code ends here.
bottom = new JLabel(.
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfanjandavid
In Java using Eclipse, I\'m suppose to write a class that encapsulates a tic tac toe board using two
dimensional arrays. It should only involve the human player vs. the computer, and should
randomly select who should use \'X\' or \'O\' and whether the human player or the computer
should go first. Verify that all moves by the human player are to a valid space on the tic-tac-toe
board, and an incorrect choice should not halt or terminate the game. Below is my Java program
that is currently a work in progress. Can you help me remodify it? Thanks.
import java.util.Scanner;
public class LeavinesTicTacToe
{
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args)
{
final int SIZE = 3;
char[][] board = new char[SIZE][SIZE]; // game board
resetBoard(board); // initialize the board (with \' \' for all cells)
// First, welcome message and display the board.
System.out.println(\"===== WELCOME TO THE TIC-TAC-TOE GAME!! =====\ \");
showBoard(board);
// Then ask the user which symbol (x or o) he/she wants to play.
System.out.print(\" Which symbol do you want to play, \\\"x\\\" or \\\"o\\\"? \");
char userSymbol = sc.next().toLowerCase().charAt(0);
char compSymbol = (userSymbol == \'x\') ? \'o\' : \'x\';
// Also ask whether or not the user wants to go first.
System.out.println();
System.out.print(\" Do you want to go first (y/n)? \");
char ans = sc.next().toLowerCase().charAt(0);
int turn; // 0 -- the user, 1 -- the computer
int remainCount = SIZE * SIZE; // empty cell count
// THE VERY FIRST MOVE.
if (ans == \'y\') {
turn = 0;
userPlay(board, userSymbol); // user puts his/her first tic
}
else {
turn = 1;
compPlay(board, compSymbol); // computer puts its first tic
}
// Show the board, and decrement the count of remaining cells.
showBoard(board);
remainCount--;
// Play the game until either one wins.
boolean done = false;
int winner = -1; // 0 -- the user, 1 -- the computer, -1 -- draw
while (!done && remainCount > 0) {
// If there is a winner at this time, set the winner and the done flag to true.
done = isGameWon(board, turn, userSymbol, compSymbol); // Did the turn won?
if (done)
winner = turn; // the one who made the last move won the game
else {
// No winner yet. Find the next turn and play.
turn = (turn + 1 ) % 2;
if (turn == 0)
userPlay(board, userSymbol);
else
compPlay(board, compSymbol);
// Show the board after one tic, and decrement the rem count.
showBoard(board);
remainCount--;
}
}
// Winner is found. Declare the winner.
if (winner == 0)
System.out.println(\"\ ** YOU WON. CONGRATULATIONS!! **\");
else if (winner == 1)
System.out.println(\"\ ** YOU LOST.. Maybe next time :) **\");
else
System.out.println(\"\ ** DRAW... **\");
}
public static void resetBoard(char[][] brd)
{
for (int i = 0; i < brd.length; i++)
for (int j = 0; j < brd[0].length; j++)
brd[i][j] = \' \';
}
public static void showBoard(char[][] brd)
{
int numRow = brd.length;
int numCol = brd[0].length;
System.out.println();
// First write the column he.
In this lesson you will learn how to use basic syntax, conditions, if-else statements and loops (for-loop, while-loop and do-while-loop) in Java and how to use the debugger.
Watch the video lesson and access the hands-on exercises here: https://softuni.org/code-lessons/java-foundations-certification-basic-syntax-conditions-and-loops
OXUS 20 is pleased to offer PART I of Java Programming Questions and Answers with details explanation to support the educational needs and hoping these series help and benefit Computer Science student, IT professionals and those who eager to learn programming and in particular Java Programming...
public interface Game Note interface in place of class { .pdfkavithaarp
public interface Game // Note *interface* in place of *class*
{
/// play the game and return the final score
/// where a higher score should be better,
/// and a negative score is allowed.
int play(); // Note semicolon in place of a body
// You can have multiple method headings declared
}
--------------------------------------------------------------------------------------------------------------
import java.util.*;
/// Starting point for Interface Lab.
public class PlayGames
{
private static Scanner in;
private static Random rand = new Random();
private static int gameCount = 0;
public static Game popRandom(Game[] g)
{
int n = gameCount;
int i = rand.nextInt(n);
Game ret = g[i];
g[i] = g[n-1];
gameCount--;
return ret;
}
public static void main(String[] args)
{
Game[] games = new Game[10]; // Note Game as a type
games[gameCount] = new AdditionGame(rand, 100);
gameCount++; // next index to put a Game at
// write at least 2 more different types of Game classes
// and add a new one of each type to games
// ...
in = new Scanner(System.in);
int totScore = 0;
do {
Game g = popRandom(games);
totScore += g.play(); // use numerical result from the game
} while (gameCount > 0 && agree(\"Want a game? \"));
System.out.println(\"Thanks for Playing!\");
System.out.println(\"Your total score is \" + totScore);
}
public static boolean agree(String prompt)
{
System.out.print(prompt);
String input = in.next();
if (input.equalsIgnoreCase(\"y\")) return true;
return false;
}
--------------------------------------------------------------------------------------------------------------------
--
import java.util.*;
public class AdditionGame implements Game // note implements!!
{
private Random rand;
private int n;
// Constructor for objects of class AdditionGame
public AdditionGame(Random r, int big)
{
rand = r;
n = big;
}
// play all games and keep score.
public int play() // exactly matches heading in Game interface
{
final int numGames = 3;
Scanner in = new Scanner(System.in);
int score = 0;
System.out.println(\"Welcome to the addition game! We\'ll now play \" + numGames
+ \" rounds.\");
for (int i = 0; i < numGames; i++) {
int x = rand.nextInt(n), y = rand.nextInt(n), ans = x+y;
System.out.print(String.format(\"Enter the sum: %d + %d = \", x, y));
int val = in.nextInt();
if (ans == val) {
System.out.println(\"Correct!\");
score++;
}
else
System.out.println(\"Wrong! Right answer is \" + ans);
}
System.out.println(\"Thanks for playing the addition game. Your score is \" + score +
\".\");
System.out.println();
return score;
}
}
--------------------------------------------------------------------------------------------------------------------
---
Create two classes that implement a Game interface:
------------------------------------
There is a Game interface defined, and also a PlayGames class that uses objects from classes that
implement that interface. The Game interface declares a single abstract method play that returns
an int, the score from playing the gam.
This slide includes: Control Flow and Functions.
That is Boolean values and operators.
It include Iteration,Fruitful functions,Scope of Variable and Modules.
#In this project you will write a program play TicTacToe #using tw.pdfaquacareser
#In this project you will write a program play TicTacToe
#using two players (labels 0,1) or one play (label 0) playing with the machine (label 1).
#The TicTacToe board has 9 integers board = [1,2,3,4,5,6,7,8,9]. The following
# are the modules for the program
#
#def reset() resets the board to the original values
# board = [1,2,3,4,5,6,7,8,9]
#
#def printBoard() print the current state of the board using the format
#
#The current TicTacToe Board
# | 1 | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#
#The current TicTacToe Board
# | X | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#Note from the above that player 0 and 1 have played numbers 8 and 1
#respectively and the board display O for player 0 and X from player 1
#
#def changeBoard(num1, player) using the chosen box number to change
#the value of the box to 0 or -1 depending on whether the player is 0 or 1,
#respectively.
#
#def play(player) prints the player number (0 or 1) and prompts the player
# to enter a box value that have not changed to \'O\' or \'X\'
#
#def checkRows(value) checks to see which of the rows of the board
# has the same value and returns True, otherwise, returns False
#
#def checkCols(value) checks to see which of the cols of the board
# has the same value and returns True, otherwise, returns False
#
#def checkDiagonal(value) checks to see which of the diagonals of the board
# has the same value and returns True, otherwise, returns False
#
#def win(player) checks if a player wins the game, returns True of the player wins
# and False otherwise
#
#def machinePlay(player) plays the role of the player using random number.
# this function generates numbers in the interval [1,9] and uses the first
# generated random number that has not been used to play the game. The
#
#def ticTacToe(numPlayers) accepts the number of players and simulates the
#ticTapToe, asking players to enter unused box numbers.
#
#def main() is the driver module that accepts the number of players from the user
# and calls the ticTacToe module
#Assignment: Complete the follwoing modules:
#checkCols
#checkRows
#checkDiagonal
#win
#Sample of the output is
#
#Project
#This game can be played by one or two players
#Enter the number of players, 1/2 for one/two players: 1
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | 9 |
#Player 0 Enter a box value: 9
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | O |
#Player 1 ***Computer*** playing
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 1
#
#The current TicTapToe Board
#| O | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 1 ***Computer*** playing
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 5
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | O | 6 |
#| 7 | X | O |
#Player 0 Wins
#Do you want to quit?
#Begin Program
#import random number generator
#from random library
#from random import randint, seed
#Global va.
#In this project you will write a program play TicTacToe #using tw.pdfaquapariwar
#In this project you will write a program play TicTacToe
#using two players (labels 0,1) or one play (label 0) playing with the machine (label 1).
#The TicTacToe board has 9 integers board = [1,2,3,4,5,6,7,8,9]. The following
# are the modules for the program
#
#def reset() resets the board to the original values
# board = [1,2,3,4,5,6,7,8,9]
#
#def printBoard() print the current state of the board using the format
#
#The current TicTacToe Board
# | 1 | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#
#The current TicTacToe Board
# | X | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#Note from the above that player 0 and 1 have played numbers 8 and 1
#respectively and the board display O for player 0 and X from player 1
#
#def changeBoard(num1, player) using the chosen box number to change
#the value of the box to 0 or -1 depending on whether the player is 0 or 1,
#respectively.
#
#def play(player) prints the player number (0 or 1) and prompts the player
# to enter a box value that have not changed to \'O\' or \'X\'
#
#def checkRows(value) checks to see which of the rows of the board
# has the same value and returns True, otherwise, returns False
#
#def checkCols(value) checks to see which of the cols of the board
# has the same value and returns True, otherwise, returns False
#
#def checkDiagonal(value) checks to see which of the diagonals of the board
# has the same value and returns True, otherwise, returns False
#
#def win(player) checks if a player wins the game, returns True of the player wins
# and False otherwise
#
#def machinePlay(player) plays the role of the player using random number.
# this function generates numbers in the interval [1,9] and uses the first
# generated random number that has not been used to play the game. The
#
#def ticTacToe(numPlayers) accepts the number of players and simulates the
#ticTapToe, asking players to enter unused box numbers.
#
#def main() is the driver module that accepts the number of players from the user
# and calls the ticTacToe module
#Assignment: Complete the follwoing modules:
#checkCols
#checkRows
#checkDiagonal
#win
#Sample of the output is
#
#Project
#This game can be played by one or two players
#Enter the number of players, 1/2 for one/two players: 1
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | 9 |
#Player 0 Enter a box value: 9
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | O |
#Player 1 ***Computer*** playing
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 1
#
#The current TicTapToe Board
#| O | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 1 ***Computer*** playing
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 5
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | O | 6 |
#| 7 | X | O |
#Player 0 Wins
#Do you want to quit?
#Begin Program
#import random number generator
#from random library
#from random import randint, seed
#Global va.
TASK #1In the domain class you will create a loop that will prompt.pdfindiaartz
TASK #1
In the domain class you will create a loop that will prompt the user to enter a value of 1, 2, or 3,
which will in turn, be translated to a floor number in the game. Make sure the user only picks a
selection you are expecting (1, 2, or 3) with a while-loop. Then you will create a switch or if-else
statement. If you are more comfortable with if-else then do switch, or if you are more
comfortable with switch then do if-else. Based on the number the user chooses you will set the
floor variable to the appropriate value. When they select 1 floor should be set to 3, when they
select 2 floor should be set to 6, and when they select 3 floor should be set to 10.
TASK #2
In the domain class you will create a constructor with 6 parameters, representing all the data
loaded from the input file that was saved from a previous adventure. This constructor receives 6
parameters: aName, anAttack, aDefense, aHealth, aCurrentFloor, & aMaxFloor.
TASK #3
In the domain class you will create a save method that will allow the user to save their progress
using a PrintWriter object. This file will overwrite whatever was there before, so no need to use
FileWriter, only PrintWriter. There are 6 attributes that you need to write to the file:
name, attack, defense, health, currentFloor, & maxFloor
public void saveFile()
{
String filename = “game.txt”;
PrintWriter pw = new PrintWriter(filename);
pw.println(name);
pw.println(attack);
pw.println(defense);
pw.println(health);
pw.println(currentFloor);
pw.println(maxFloor);
pw.close();
}
TASK #4
In the driver class you will create a load method that will allow the user to pick up from where
they left off. You will do this using a File object and a Scanner object. Remember to use the File
and Scanner classes, and to close the file object after you’re done. There are 6 attributes you will
need to load from the file to successfully continue an Adventure:
name, attack, defense, health, currentFloor, & maxFloor
After you read the record from the file, and store the data in these 6 variables, you can create a
new Adventure object called JavaQuest with those 6 variables. Remember JavaQuest is a global
variable defined at the beginning of the driver class. Then, within the load method, invoke the
startAdventure() method for the newly created Adventure object.
public static void load()
{
String filename = “load.txt”;
File myFile = new File(filename);
Scanner myScan = new Scanner(myFile);
String name;
int attack, defense, health, currentFloor, maxFloor;
name = myScan.nextLine();
attack = myScan.nextInt();
myScan.nextLine();
defense = myScan.nextInt();
myScan.nextLine();
…
javaQuest = new Adventure(name, attack, defense, health, currentFloor, maxFloor);
}
javaQuest.startAdventure();
The Files
package Adventure;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;
import java.util.Scanner;
public class Adventure
{
int health, defense, attack;
String mons.
Construct a java method. This method chooses the number of sti.pdfarihantmobilepoint15
Construct a java method.
* This method chooses the number of sticks to pick up based on the
* sticksRemaining and actionRanking parameters.
*
* Algorithm: If there are less than Config.MAX_ACTION sticks remaining
* then the chooser must pick the minimum number of sticks (Config.MIN_ACTION).
* For Config.MAX_ACTION or more sticks remaining then pick based on the
* actionRanking parameter.
*
* The actionRanking array has one element for each possible action. The 0
* index corresponds to Config.MIN_ACTION and the highest index corresponds
* to Config.MAX_ACTION. For example, if Config.MIN_ACTION is 1 and
* Config.MAX_ACTION is 3, an action can be to pick up 1, 2 or 3 sticks.
* actionRanking[0] corresponds to 1, actionRanking[1] corresponds to 2, etc.
* The higher the element for an action in comparison to other elements,
* the more likely the action should be chosen.
*
* First calculate the total number of possibilities by summing all the
* element values. Then choose a particular action based on the relative
* frequency of the various rankings.
* For example, if Config.MIN_ACTION is 1 and Config.MAX_ACTION is 3:
* If the action rankings are {9,90,1}, the total is 100. Since
* actionRanking[0] is 9, then an action of picking up 1 should be chosen
* about 9/100 times. 2 should be chosen about 90/100 times and 1 should
* be chosen about 1/100 times. Use Config.RNG.nextInt(?) method to
* generate appropriate random numbers.
*
* @param sticksRemaining
* The number of sticks remaining to be picked up.
* @param actionRanking
* The counts of each action to take. The 0 index corresponds to
* Config.MIN_ACTION and the highest index corresponds to
* Config.MAX_ACTION.
* @return The number of sticks to pick up. 0 is returned for the following
* conditions: actionRanking is null, actionRanking has a length of
* 0, or sticksRemaining is <= 0.
Solution
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String userName = \"\";
String intialStringError = \"\";
int intialSticks = 0;
String prompt = \"How many sticks are there on the table initially (10-100)? \";
//Max number of tries
int[] numSticksArray = new int[100];
boolean intialBooleanError = false;
boolean userChoiceDone = false;
int userChoice = 0;
String userError = \"\";
String friendName = \"\";
int userStickNum = 0;
String userStickError = \"\";
String friendStickError = \"\";
boolean friendTurnOver = true;
boolean userTurnOver = true;
int z = 0;
System.out.print(\"\ What is your name? \");
userName = input.nextLine();
System.out.println(\"Hello \" + userName.trim() + \".\");
intialSticks = promptUserForNumber(input, prompt, Config.MIN_STICKS,
Config.MAX_STICKS);
System.out.println(\"\ Would you like to:\");
System.out.println(\" 1) Play against a friend\");
System.out.println(\" 2) Play against computer (basic)\");
System.out.println(\" 3) Play against computer with AI\");
do{
System.out.print(\"Which do you choose (1,2,3)? \");
if(input.hasNextInt())
{
userChoice = inp.
In order to determine the overall chromosome map for E. coli, four Hf.pdfFashionColZone
In order to determine the overall chromosome map for E. coli, four Hfr strains (#1, 2, 3, & 4)
were obtained from F+ ancestors. The start times of transfer during conjugation matings with F-
strains carrying auxotrophic and fermentation markers were determined for each Hfr strain, as
listed. Using the times for transfer of each maker, draw a unified chromosome map of E. coli,
showing the order and relative distances between these markers. Place the origin of transfer (site
of F insertion) on the map for each Hfr strain. What is the total length of the E. coli
chromosome, in transfer minutes?
Solution
The process of assigning genes to particular locations on a chromosome is known as
chromosome mapping and the map is called gene map. There are many methods used by
scientists to find out the correct location by mapping genes. By using these methods different
chromosome maps can be prepared like cytogenetic maps, linkage maps, DNA sequence maps or
physical maps. Hfr strain indicates a high frequency of recombinants. The polarity of the Hfr
chromosome is determined by the orientation in which F+ is inserted in it. The relative position
of chromosomes on a gene can be found out by linkage maps which are measured in time taken
by second gene in following the first one during conjugation. Here it is assumed that genes
separated by 10 minutes near the entry end are physically same distance apart as the genes
separated by 10 minutes at the F attachment site..
In a fantasy world where organisms can augment diffusion by using ma.pdfFashionColZone
In a fantasy world where organisms can augment diffusion by using magic to make molecules
move faster and in a non-random manner, which of the following would we expect to find?
Question 7 options:
Large, complex multicellular organisms with sophisticated internal transport organs
Large, complex multicellular organisms without any structures for bulk flow
Small, simple multicellular organisms with systems for sharing nutrients between cells
An absence of cell wall structures around unicellular organisms
Save
Large, complex multicellular organisms with sophisticated internal transport organs
Large, complex multicellular organisms without any structures for bulk flow
Small, simple multicellular organisms with systems for sharing nutrients between cells
An absence of cell wall structures around unicellular organisms
Solution
In a fantasy world where organisms can augment diffusion by using magic to make molecules
move faster and in a non-random manner,
Large, complex multicellular organisms with sophisticated internal transport organs because the
molecules are moving in a nn random fashion in order to streamline their movement it is
essential to have a multicellular organism with sophisticated internal transport organs..
More Related Content
Similar to You will write a multi-interface version of the well-known concentra.pdf
OXUS 20 is pleased to offer PART I of Java Programming Questions and Answers with details explanation to support the educational needs and hoping these series help and benefit Computer Science student, IT professionals and those who eager to learn programming and in particular Java Programming...
public interface Game Note interface in place of class { .pdfkavithaarp
public interface Game // Note *interface* in place of *class*
{
/// play the game and return the final score
/// where a higher score should be better,
/// and a negative score is allowed.
int play(); // Note semicolon in place of a body
// You can have multiple method headings declared
}
--------------------------------------------------------------------------------------------------------------
import java.util.*;
/// Starting point for Interface Lab.
public class PlayGames
{
private static Scanner in;
private static Random rand = new Random();
private static int gameCount = 0;
public static Game popRandom(Game[] g)
{
int n = gameCount;
int i = rand.nextInt(n);
Game ret = g[i];
g[i] = g[n-1];
gameCount--;
return ret;
}
public static void main(String[] args)
{
Game[] games = new Game[10]; // Note Game as a type
games[gameCount] = new AdditionGame(rand, 100);
gameCount++; // next index to put a Game at
// write at least 2 more different types of Game classes
// and add a new one of each type to games
// ...
in = new Scanner(System.in);
int totScore = 0;
do {
Game g = popRandom(games);
totScore += g.play(); // use numerical result from the game
} while (gameCount > 0 && agree(\"Want a game? \"));
System.out.println(\"Thanks for Playing!\");
System.out.println(\"Your total score is \" + totScore);
}
public static boolean agree(String prompt)
{
System.out.print(prompt);
String input = in.next();
if (input.equalsIgnoreCase(\"y\")) return true;
return false;
}
--------------------------------------------------------------------------------------------------------------------
--
import java.util.*;
public class AdditionGame implements Game // note implements!!
{
private Random rand;
private int n;
// Constructor for objects of class AdditionGame
public AdditionGame(Random r, int big)
{
rand = r;
n = big;
}
// play all games and keep score.
public int play() // exactly matches heading in Game interface
{
final int numGames = 3;
Scanner in = new Scanner(System.in);
int score = 0;
System.out.println(\"Welcome to the addition game! We\'ll now play \" + numGames
+ \" rounds.\");
for (int i = 0; i < numGames; i++) {
int x = rand.nextInt(n), y = rand.nextInt(n), ans = x+y;
System.out.print(String.format(\"Enter the sum: %d + %d = \", x, y));
int val = in.nextInt();
if (ans == val) {
System.out.println(\"Correct!\");
score++;
}
else
System.out.println(\"Wrong! Right answer is \" + ans);
}
System.out.println(\"Thanks for playing the addition game. Your score is \" + score +
\".\");
System.out.println();
return score;
}
}
--------------------------------------------------------------------------------------------------------------------
---
Create two classes that implement a Game interface:
------------------------------------
There is a Game interface defined, and also a PlayGames class that uses objects from classes that
implement that interface. The Game interface declares a single abstract method play that returns
an int, the score from playing the gam.
This slide includes: Control Flow and Functions.
That is Boolean values and operators.
It include Iteration,Fruitful functions,Scope of Variable and Modules.
#In this project you will write a program play TicTacToe #using tw.pdfaquacareser
#In this project you will write a program play TicTacToe
#using two players (labels 0,1) or one play (label 0) playing with the machine (label 1).
#The TicTacToe board has 9 integers board = [1,2,3,4,5,6,7,8,9]. The following
# are the modules for the program
#
#def reset() resets the board to the original values
# board = [1,2,3,4,5,6,7,8,9]
#
#def printBoard() print the current state of the board using the format
#
#The current TicTacToe Board
# | 1 | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#
#The current TicTacToe Board
# | X | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#Note from the above that player 0 and 1 have played numbers 8 and 1
#respectively and the board display O for player 0 and X from player 1
#
#def changeBoard(num1, player) using the chosen box number to change
#the value of the box to 0 or -1 depending on whether the player is 0 or 1,
#respectively.
#
#def play(player) prints the player number (0 or 1) and prompts the player
# to enter a box value that have not changed to \'O\' or \'X\'
#
#def checkRows(value) checks to see which of the rows of the board
# has the same value and returns True, otherwise, returns False
#
#def checkCols(value) checks to see which of the cols of the board
# has the same value and returns True, otherwise, returns False
#
#def checkDiagonal(value) checks to see which of the diagonals of the board
# has the same value and returns True, otherwise, returns False
#
#def win(player) checks if a player wins the game, returns True of the player wins
# and False otherwise
#
#def machinePlay(player) plays the role of the player using random number.
# this function generates numbers in the interval [1,9] and uses the first
# generated random number that has not been used to play the game. The
#
#def ticTacToe(numPlayers) accepts the number of players and simulates the
#ticTapToe, asking players to enter unused box numbers.
#
#def main() is the driver module that accepts the number of players from the user
# and calls the ticTacToe module
#Assignment: Complete the follwoing modules:
#checkCols
#checkRows
#checkDiagonal
#win
#Sample of the output is
#
#Project
#This game can be played by one or two players
#Enter the number of players, 1/2 for one/two players: 1
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | 9 |
#Player 0 Enter a box value: 9
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | O |
#Player 1 ***Computer*** playing
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 1
#
#The current TicTapToe Board
#| O | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 1 ***Computer*** playing
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 5
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | O | 6 |
#| 7 | X | O |
#Player 0 Wins
#Do you want to quit?
#Begin Program
#import random number generator
#from random library
#from random import randint, seed
#Global va.
#In this project you will write a program play TicTacToe #using tw.pdfaquapariwar
#In this project you will write a program play TicTacToe
#using two players (labels 0,1) or one play (label 0) playing with the machine (label 1).
#The TicTacToe board has 9 integers board = [1,2,3,4,5,6,7,8,9]. The following
# are the modules for the program
#
#def reset() resets the board to the original values
# board = [1,2,3,4,5,6,7,8,9]
#
#def printBoard() print the current state of the board using the format
#
#The current TicTacToe Board
# | 1 | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#
#The current TicTacToe Board
# | X | 2 | 3 |
# | 4 | 5 | 6 |
# | 7 | O | 9 |
#Note from the above that player 0 and 1 have played numbers 8 and 1
#respectively and the board display O for player 0 and X from player 1
#
#def changeBoard(num1, player) using the chosen box number to change
#the value of the box to 0 or -1 depending on whether the player is 0 or 1,
#respectively.
#
#def play(player) prints the player number (0 or 1) and prompts the player
# to enter a box value that have not changed to \'O\' or \'X\'
#
#def checkRows(value) checks to see which of the rows of the board
# has the same value and returns True, otherwise, returns False
#
#def checkCols(value) checks to see which of the cols of the board
# has the same value and returns True, otherwise, returns False
#
#def checkDiagonal(value) checks to see which of the diagonals of the board
# has the same value and returns True, otherwise, returns False
#
#def win(player) checks if a player wins the game, returns True of the player wins
# and False otherwise
#
#def machinePlay(player) plays the role of the player using random number.
# this function generates numbers in the interval [1,9] and uses the first
# generated random number that has not been used to play the game. The
#
#def ticTacToe(numPlayers) accepts the number of players and simulates the
#ticTapToe, asking players to enter unused box numbers.
#
#def main() is the driver module that accepts the number of players from the user
# and calls the ticTacToe module
#Assignment: Complete the follwoing modules:
#checkCols
#checkRows
#checkDiagonal
#win
#Sample of the output is
#
#Project
#This game can be played by one or two players
#Enter the number of players, 1/2 for one/two players: 1
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | 9 |
#Player 0 Enter a box value: 9
#
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | 8 | O |
#Player 1 ***Computer*** playing
#The current TicTapToe Board
#| 1 | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 1
#
#The current TicTapToe Board
#| O | 2 | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 1 ***Computer*** playing
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | 5 | 6 |
#| 7 | X | O |
#Player 0 Enter a box value: 5
#
#The current TicTapToe Board
#| O | X | 3 |
#| 4 | O | 6 |
#| 7 | X | O |
#Player 0 Wins
#Do you want to quit?
#Begin Program
#import random number generator
#from random library
#from random import randint, seed
#Global va.
TASK #1In the domain class you will create a loop that will prompt.pdfindiaartz
TASK #1
In the domain class you will create a loop that will prompt the user to enter a value of 1, 2, or 3,
which will in turn, be translated to a floor number in the game. Make sure the user only picks a
selection you are expecting (1, 2, or 3) with a while-loop. Then you will create a switch or if-else
statement. If you are more comfortable with if-else then do switch, or if you are more
comfortable with switch then do if-else. Based on the number the user chooses you will set the
floor variable to the appropriate value. When they select 1 floor should be set to 3, when they
select 2 floor should be set to 6, and when they select 3 floor should be set to 10.
TASK #2
In the domain class you will create a constructor with 6 parameters, representing all the data
loaded from the input file that was saved from a previous adventure. This constructor receives 6
parameters: aName, anAttack, aDefense, aHealth, aCurrentFloor, & aMaxFloor.
TASK #3
In the domain class you will create a save method that will allow the user to save their progress
using a PrintWriter object. This file will overwrite whatever was there before, so no need to use
FileWriter, only PrintWriter. There are 6 attributes that you need to write to the file:
name, attack, defense, health, currentFloor, & maxFloor
public void saveFile()
{
String filename = “game.txt”;
PrintWriter pw = new PrintWriter(filename);
pw.println(name);
pw.println(attack);
pw.println(defense);
pw.println(health);
pw.println(currentFloor);
pw.println(maxFloor);
pw.close();
}
TASK #4
In the driver class you will create a load method that will allow the user to pick up from where
they left off. You will do this using a File object and a Scanner object. Remember to use the File
and Scanner classes, and to close the file object after you’re done. There are 6 attributes you will
need to load from the file to successfully continue an Adventure:
name, attack, defense, health, currentFloor, & maxFloor
After you read the record from the file, and store the data in these 6 variables, you can create a
new Adventure object called JavaQuest with those 6 variables. Remember JavaQuest is a global
variable defined at the beginning of the driver class. Then, within the load method, invoke the
startAdventure() method for the newly created Adventure object.
public static void load()
{
String filename = “load.txt”;
File myFile = new File(filename);
Scanner myScan = new Scanner(myFile);
String name;
int attack, defense, health, currentFloor, maxFloor;
name = myScan.nextLine();
attack = myScan.nextInt();
myScan.nextLine();
defense = myScan.nextInt();
myScan.nextLine();
…
javaQuest = new Adventure(name, attack, defense, health, currentFloor, maxFloor);
}
javaQuest.startAdventure();
The Files
package Adventure;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;
import java.util.Scanner;
public class Adventure
{
int health, defense, attack;
String mons.
Construct a java method. This method chooses the number of sti.pdfarihantmobilepoint15
Construct a java method.
* This method chooses the number of sticks to pick up based on the
* sticksRemaining and actionRanking parameters.
*
* Algorithm: If there are less than Config.MAX_ACTION sticks remaining
* then the chooser must pick the minimum number of sticks (Config.MIN_ACTION).
* For Config.MAX_ACTION or more sticks remaining then pick based on the
* actionRanking parameter.
*
* The actionRanking array has one element for each possible action. The 0
* index corresponds to Config.MIN_ACTION and the highest index corresponds
* to Config.MAX_ACTION. For example, if Config.MIN_ACTION is 1 and
* Config.MAX_ACTION is 3, an action can be to pick up 1, 2 or 3 sticks.
* actionRanking[0] corresponds to 1, actionRanking[1] corresponds to 2, etc.
* The higher the element for an action in comparison to other elements,
* the more likely the action should be chosen.
*
* First calculate the total number of possibilities by summing all the
* element values. Then choose a particular action based on the relative
* frequency of the various rankings.
* For example, if Config.MIN_ACTION is 1 and Config.MAX_ACTION is 3:
* If the action rankings are {9,90,1}, the total is 100. Since
* actionRanking[0] is 9, then an action of picking up 1 should be chosen
* about 9/100 times. 2 should be chosen about 90/100 times and 1 should
* be chosen about 1/100 times. Use Config.RNG.nextInt(?) method to
* generate appropriate random numbers.
*
* @param sticksRemaining
* The number of sticks remaining to be picked up.
* @param actionRanking
* The counts of each action to take. The 0 index corresponds to
* Config.MIN_ACTION and the highest index corresponds to
* Config.MAX_ACTION.
* @return The number of sticks to pick up. 0 is returned for the following
* conditions: actionRanking is null, actionRanking has a length of
* 0, or sticksRemaining is <= 0.
Solution
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String userName = \"\";
String intialStringError = \"\";
int intialSticks = 0;
String prompt = \"How many sticks are there on the table initially (10-100)? \";
//Max number of tries
int[] numSticksArray = new int[100];
boolean intialBooleanError = false;
boolean userChoiceDone = false;
int userChoice = 0;
String userError = \"\";
String friendName = \"\";
int userStickNum = 0;
String userStickError = \"\";
String friendStickError = \"\";
boolean friendTurnOver = true;
boolean userTurnOver = true;
int z = 0;
System.out.print(\"\ What is your name? \");
userName = input.nextLine();
System.out.println(\"Hello \" + userName.trim() + \".\");
intialSticks = promptUserForNumber(input, prompt, Config.MIN_STICKS,
Config.MAX_STICKS);
System.out.println(\"\ Would you like to:\");
System.out.println(\" 1) Play against a friend\");
System.out.println(\" 2) Play against computer (basic)\");
System.out.println(\" 3) Play against computer with AI\");
do{
System.out.print(\"Which do you choose (1,2,3)? \");
if(input.hasNextInt())
{
userChoice = inp.
In order to determine the overall chromosome map for E. coli, four Hf.pdfFashionColZone
In order to determine the overall chromosome map for E. coli, four Hfr strains (#1, 2, 3, & 4)
were obtained from F+ ancestors. The start times of transfer during conjugation matings with F-
strains carrying auxotrophic and fermentation markers were determined for each Hfr strain, as
listed. Using the times for transfer of each maker, draw a unified chromosome map of E. coli,
showing the order and relative distances between these markers. Place the origin of transfer (site
of F insertion) on the map for each Hfr strain. What is the total length of the E. coli
chromosome, in transfer minutes?
Solution
The process of assigning genes to particular locations on a chromosome is known as
chromosome mapping and the map is called gene map. There are many methods used by
scientists to find out the correct location by mapping genes. By using these methods different
chromosome maps can be prepared like cytogenetic maps, linkage maps, DNA sequence maps or
physical maps. Hfr strain indicates a high frequency of recombinants. The polarity of the Hfr
chromosome is determined by the orientation in which F+ is inserted in it. The relative position
of chromosomes on a gene can be found out by linkage maps which are measured in time taken
by second gene in following the first one during conjugation. Here it is assumed that genes
separated by 10 minutes near the entry end are physically same distance apart as the genes
separated by 10 minutes at the F attachment site..
In a fantasy world where organisms can augment diffusion by using ma.pdfFashionColZone
In a fantasy world where organisms can augment diffusion by using magic to make molecules
move faster and in a non-random manner, which of the following would we expect to find?
Question 7 options:
Large, complex multicellular organisms with sophisticated internal transport organs
Large, complex multicellular organisms without any structures for bulk flow
Small, simple multicellular organisms with systems for sharing nutrients between cells
An absence of cell wall structures around unicellular organisms
Save
Large, complex multicellular organisms with sophisticated internal transport organs
Large, complex multicellular organisms without any structures for bulk flow
Small, simple multicellular organisms with systems for sharing nutrients between cells
An absence of cell wall structures around unicellular organisms
Solution
In a fantasy world where organisms can augment diffusion by using magic to make molecules
move faster and in a non-random manner,
Large, complex multicellular organisms with sophisticated internal transport organs because the
molecules are moving in a nn random fashion in order to streamline their movement it is
essential to have a multicellular organism with sophisticated internal transport organs..
Hello, I need some assistance in writing a java program THAT MUST US.pdfFashionColZone
Hello, I need some assistance in writing a java program THAT MUST USE STACKS (LIFO).
Create a Calculator w/ GUI
Write a program that graphically displays a working calculator for simple infix expressions that
consist of: single-digit operands, the operators: +, -, *, and /, and parentheses.
Make the following assumptions:
unary operators (e.g. -2) are illegal
all operations, including division, are integer operations (and results are integers)
the input expression contains no embedded spaces and no illegal characters
the input expression is a syntactically correct infix expression
division by zero will not occur (consider how you can remove this restriction)
Create a GUI application, the calculator has a display and a keypad of 20 keys, which are
arranged as follows:
C
<
Q
/
7
8
9
*
4
5
6
-
1
2
3
+
0
(
)
=
As the user presses keys to enter an infix expression, the corresponding characters appear in the
display. The C (Clear) key erases all input entered so far; the < (Backspace) key erases the last
character entered. When the user presses the = key, the expression is evaluated and the result
appended to the right end of the expression in the display window. The user can then press C and
enter another expression. If the user presses the Q (Quit) key, the calculator ceases operation and
is erased from the screen.
C
<
Q
/
7
8
9
*
4
5
6
-
1
2
3
+
0
(
)
=
Solution
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Calculator extends JFrame implements ActionListener {
JPanel[] row = new JPanel[5];
JButton[] button = new JButton[19];
String[] buttonString = {\"7\", \"8\", \"9\", \"+\",
\"4\", \"5\", \"6\", \"-\",
\"1\", \"2\", \"3\", \"*\",
\".\", \"/\", \"C\", \"\",
\"+/-\", \"=\", \"0\"};
int[] dimW = {300,45,100,90};
int[] dimH = {35, 40};
Dimension displayDimension = new Dimension(dimW[0], dimH[0]);
Dimension regularDimension = new Dimension(dimW[1], dimH[1]);
Dimension rColumnDimension = new Dimension(dimW[2], dimH[1]);
Dimension zeroButDimension = new Dimension(dimW[3], dimH[1]);
boolean[] function = new boolean[4];
double[] temporary = {0, 0};
JTextArea display = new JTextArea(1,20);
Font font = new Font(\"Times new Roman\", Font.BOLD, 14);
Calculator() {
super(\"Calculator\");
setDesign();
setSize(380, 250);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
GridLayout grid = new GridLayout(5,5);
setLayout(grid);
for(int i = 0; i < 4; i++)
function[i] = false;
FlowLayout f1 = new FlowLayout(FlowLayout.CENTER);
FlowLayout f2 = new FlowLayout(FlowLayout.CENTER,1,1);
for(int i = 0; i < 5; i++)
row[i] = new JPanel();
row[0].setLayout(f1);
for(int i = 1; i < 5; i++)
row[i].setLayout(f2);
for(int i = 0; i < 19; i++) {
button[i] = new JButton();
button[i].setText(buttonString[i]);
button[i].setFont(font);
button[i].addActionListener(this);
}
display.setFont(font);
display.setEditable(false);
display.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
display.setPreferredSize(displayDimension);
for(int.
Explain how consumer judges the quality of service (Including price .pdfFashionColZone
Explain how consumer judges the quality of service (Including price as indicator of quality)
Solution
It is more difficult for consumers to evaluate the quality of service than the quality of products.
This is true because of certain distinctive characteristics of services; They are intangible, they are
variable, they are perishable, and they are simultaneously produced and consumed. To overcome
the fact that consumers are unable to compare competining services side-by-side as they do with
competing pproducts, consumers rely on surrogate cues (i.e., extrinsic cues) to evaluate the
service quality. It must be noted here that the service quality is a perception of the consumer and
not described in absoolute terms like in the case of products.
Perceived service value has been described as a trade-off between the perceived benefits
(quality) of service and the perceived sacrifice - both monetary and non-monetary - necessary to
acquire it. Consumers rely on price as an indicator of service quality. Consumers using a price /
quality relationship are actually relying on a well-known (and, hence, more expensive) brand
name as an indicator of quality without actually relying directly on price per se. Consumers also
use price and brand to evaluate the prestige of the product but do not generally use these cues
when they evaluate the service delivery and performance. Since, price is so often considered as
an indicator of quality, consumers perceive a service to be of higher quality based on the pricing
of the service. However, on other hand, when the consumers evaluate the service more critically,
then they rely less on the price and brand as indicators of service quality..
Early Americans did not practice equality according to today’s defin.pdfFashionColZone
Early Americans did not practice equality according to today’s definitions; however, the concept
of equality has always been an important part of American rhetoric with an evolving
definition. Politicians considered women, blacks, and the lower classes as “dependent”, as they
owed their livelihood to someone else. They were thought not to have the “independence” to
form conclusions. How is Mercy Otis Warren an example against this theory?
Solution
Mercy Otis Warren was a political writer and propagandist of the American Revolution. In the
eighteenth century, topics such as politics and war were thought to be the province of men. Few
men and fewer women had the education or training to write about these subjects. Warren was an
exception. During the years before the American Revolution, Warren published poems and plays
that attacked royal authority in Massachusetts and urged colonists to resist British infringements
on colonial rights and liberties.
During the debate over the United States Constitution in 1788, she issued a pamphlet,
Observations on the new Constitution, and on the Federal and State Conventions written under
the pseudonym \"A Columbian Patriot,\" that opposed ratification of the document and
advocated the inclusion of a Bill of Rights. Observations was long thought to be the work of
other writers, most notably Elbridge Gerry. It was not until her descendant, Charles Warren,
found a reference to it in a 1787 letter to British historian, Catharine Macaulay, that Warren was
accredited authorship.In 1790, she published a collection of poems and plays under her own
name, a highly unusual occurrence for a woman at the time. In 1805, she published one of the
earliest histories of the American Revolution, a three-volumeHistory of the Rise, Progress, and
Termination of the American Revolution, the first history of the American Revolution authored
by a woman..
Do you think that the level of prosperity of a given society influen.pdfFashionColZone
Do you think that the level of prosperity of a given society influences the development of
mathematics and scientific knowledge in that society? Provide examples of how these issues
might be connected.
Solution
Eighty percent of the scientists who have ever lived are alive today.More surprisingly, the same
statement could have been made one, or two centuries ago.Not only the science has been
expanding rapidly since the Scientific revolution of seventeenth century, it has emerged as a
dominant force in our culture.This suggests why many eduvators have realized that an
understanding of the evolution of science and of its influence on our society is a vital part of our
education.
Contemprary societies are marked by new global trends-- economic, cultural, technological, and
environmental shifts that are part of a rapid and uneven wave of globalization.The growing
global interdependence that characterizes our time calls for a generation of individuals who can
engage in global problem solving and participate simultaneously in local, national and global
civic life.This surely asks for the development of mathematics and scientific knowldge in our
society which is definitely growing in terms of prosperity.
The history of Mathematical notation includes the commencement, progress and cultural
diffusion of mathematical symbols and the conflicts of the method of notation confronted in
notation\'s move to popularity .Written Mathematics began with the numbers expressed as tally
marks, with each tally representing a single unit.The numerical symbols consisted of strokes or
notches cut in wood or stone, an intelligible alike to all nations.For example one notch in a bone
represented one animal, or person, or anything else.
If we look at today\'s socitey than all these sybols have developed in a certain way with each
growing period.These have evolved over years now and this shows how with the growth and
prosperity the developments in Mathematics is related.
The necessaity of accurately tracking the latitude and longitude for instance has influenced the
developement in Mathematics and Science..
Design a circuit that detect the sequence 0110. Draw the Moore sta.pdfFashionColZone
Design a circuit that detect the sequence 0110.
Draw the Moore state machine for detecting non-overlapping sequences
Write the truth table that shows the next state based on T flip flops
Draw the circuit
Re-do the More state machine graph for overlapping sequences (do the state machine only)
Solution
A)This sort of situation might arise for a simple code lock, where the user must enter the correct
4 bits to open the lock. If the user doesn’t input the correct 4 bits, they must start over. Or, it
might be used in a simple communication system which receives bits off a line one at a time, and
the word size is 4 bits. In this case, the patterns might be start and stop signals, or some other
communication protocol-related information. The input is defined as X. Thus, the value of X is
the value of the input line in a given clock cycle. The output, Y, goes high for 1 clock cycle as
soon as it receives the 4th bit that matches a pattern. We have only one input and only one
output, so we don’t need to use ASM charts. We can use a simple state diagram. Note that
because the output must go high as soon as the 4th matching bit is received, we need this to be a
Mealy machine. Also, note that in this example, when we are looking for 1010, we assume the
most significant bit is the first bit received, so the order of the inputs would be 1-0-1-0, not 0-1-
0-1.
Our state machine starts in a state in which we have received no bits. We will call this state
START. The state transitions will be depending on whether the input X is a 0 or 1 – we can
essentially use the states to record which values have been received. If the input is 0, we
transition to a state called S0; if X is 1, we transition to S1. These states are named after the
value received in the previous clock cycle. From each of S0 and S1, we can likewise go to new
states based on the value of X. If in S0, and X is 0, we go to state S00; if X is 1, we go to state
S01. Similarly, if in S1, and X is 0, we go to state S10; if X is 1, we go to state S11. Again, the
states are named after the two previously received values. Now, each of those four states can
again go to one of two possible states, based on the value of X. The states are S000, S001, S010,
S011, S100, S101, S110, S111. At this point, the state machine knows we have received 3 bits,
and knows what those 3 bits are. When it receives the next bit, it can determine whether a
matching sequence was input, or whether we need to restart.
So, S000, S001, S010, S100, S110, and S111 all transition back to START and output 0, no
matter what the input, because none of those states correspond to having received the first 3 bits
of sequences 0110 or 1010. States S011 and S101, however, do depend on the input. They both
still transition back to START, but if the input is 0, the output is 1. Otherwise, the output remains
0. Thus the state machine meets our design requirements.
So we have a state machine that has 15 states. 15 states is quite a lot. This requ.
Cyanide is a potent toxin that can kill a human in minutes. It funct.pdfFashionColZone
Cyanide is a potent toxin that can kill a human in minutes. It functions by inhibiting complex IV
of the electron transport chain (ETC). Based on your understanding of cellular respiration,
Illustrate the ETC. Be sure to include all components of the electron transport chain, electron
donors, and the movement of both electrons and protons.
Indicate with an “X” the site of action for cyanide (color might be helpful)
Explain why cyanide exposure is lethal.
Briefly describe the effects it has on each process of cellular respiration.
Solution
Cyanide poisoning occurs when a person comes in direct exposure of cyanide gas. This cyanide
gas interfere with complex IV of electron transport chain. This complex IV is also known as
cytochrome C oxidase. it is a large transmembrane protein complex found in mitochondria of
human cells. This mitochondra is the cell organalle where cellular respiration through electron
transport chain occurs.
Electron transport chain: There are 5 components of electron transport chain which are found on
the inner membrane of mitochondria.
1. Nicotonamide nucleotides
2. Flavoproteins
3. Iron - sulphur proteins
4. Quinones and
5. Cytochromes
cytochrome I
cytochrome II
cytochrome III
cytochrome IV
During cellular respiration the cells consume oxygen for the oxidation of nutrients ( glucose,
fatty acids, amino acids) and this oxygen act as electron accapter. After kreb\'s cycle the electron
moves via NAD to FAD and then electron moves to cytochromes I to cytochrome II, cytochrome
III and finally to cytochrome IV. This cytochrome IV transfer electrons to oxygen atom due to
which oxygen atoms consumes 4 H+ ion from matrix to form water molecule. Due to
consumption of 4 hydrogen ion from matrix, 4 hydrogen ions from outside the mitochondria
enters to the matrix and converts ADP into ATP to store the biochemical energy. Hence the
whole process of electron transport chain can be shown as follows:
Electron------NAD------FAD-------Cytochrome I------cytochrome III-----\"X\"----cytochrome IV
Transfer of electrons from cytochrome III to cytochrome IV is catalysed by enzyme cytochrome
c oxidase (complex IV). During cyanide poisoning the cyanide ion interfers with this cytochrome
c oxidase enzyme and inhibit the transfer of electrons from cytochrome III to IV.
Since cyanide poisonong interferes with cellular respiration it interrupts the energy source for
humane being. It creates hypoxia. Thatswhy cyanide poisoning could be lethal..
A Fullerene is a 3-regular planar graph with faces of degree 5 and 6.pdfFashionColZone
A Fullerene is a 3-regular planar graph with faces of degree 5 and 6. Let P be the number of
pentagons (degree 5 faces) and H be the number of hexagons (degree 6 faces). Given that a
Fullerene has v vertices, determine P and H as functions of v.
Solution
Here there are P faces of degree five( pentagons ) and H faces of degree six( Hexagons)
Then there are F = P+H faces
we know from eulers formula that F= 2 + E - V
By 3 Regularity we know 2E = 3V
so P+H = F = 2 + 3V/2 -V
= 2 + V/2
Further by handshaking for planar graphs we know
2E = 5P + 6H
so , 3V= 2 E = 5P + 6H
= 5(P+H) + H
= 5(2+ v/2) + H
This tells us that
v = 2H + 20,
so H = V/2 - 10
as P + H = 2+V/2
we conclude
P = 2+ V/2 - H
= 2+ V/2 - (V/2 - 10)
= 12.
Assume that the paired date came from a population that is normally .pdfFashionColZone
Assume that the paired date came from a population that is normally distributed. Using a .05
significance level, find d, Sd, the test t statistic, and the critical values to test the claim that
Ud=0.
x 7 10 12 12 3 15 17 8
y 12 12 7 8 8 11 12 5
d=
Sd=
t=
t a/2 = +-
Round all to three decimal places.
Thank you in advance!!
Solution.
Briefly describe three processing schema used in cochlear implants..pdfFashionColZone
Briefly describe three processing schema used in cochlear implants.
Solution
ecology:
It is a branch of biological science that deals with the relations of different organisms to one
another and to their physical surroundings which can be varies species to species. It is a very
much scientific approach to study the relationship between organism and the environment
system. geography and earth science are equally important for ecology.
example for how ecology is integrative across a suite of biological discipline:
we can say that the biodiversity is the greatest example of ecology which is hugely connected
with biological descipline. food pyramid, food chain,food web maintain the relationship between
different species and also with ecosystem.Ecosystems is always sustaining life-supporting
functions and produce natural things like biomass production which help to grow. wetland
management is also another example.
an example of the link between ecology and evolution
Life history,Natural selection, adaptation, development, inheritance and populations are different
type of example between the link of ecology and evolution. morphological, behaviorial study
generally helping us to study evolution. taxonomy is also very important terms here.
ecology and evolution inform conservation biology
Firstle I can say that evolutionary biology is a necessary component for conservation or you can
say conservation biology in terms of biomass or system and sorroundings. These are all the
primary lenders behind long-term, sustainable biological collections, because we need to know
what actually exists in order to better understand organism , species, geographical and earth and
natural evolutionary history. Now The second most important key we can say that by
understanding lots of different causes of diversification. And finally we know that evolution
allows us for an better understanding of the potential responses to human disturbance like in
population size..
A satellite moves in a circular orbit around Earth at a speed of 470.pdfFashionColZone
A satellite moves in a circular orbit around Earth at a speed of 4705 m/s.
(a) Determine the satellite\'s altitude above the surface of Earth.
m
(b) Determine the period of the satellite\'s orbit.
h
.
Solution
r = G M / v2 = (6.673 * 10-11 * 5.97 * 1024) / (47052)
= 1.799 * 107 m
The satellite\'s altitude above the Earth\'s surface is h = r - R
= (1.799 * 107) - (6.378 * 106) = 1.16 * 107 m
The satellite\'s orbital period T = 2 pi r /v
= (2 pi * 1.799 * 107) / 4705
= 24024 sec = 6.67 hrs.
7. What do we mean by “spreading signal”in CDMA systems16. Name a.pdfFashionColZone
7. What do we mean by “spreading signal”in CDMA systems?
16. Name available channels in CDMA for both forward and reverse links.
Solution
7)
In CDMA systems the entire users spread in the same bandwidth at the same time.
Communication system follow these concept are spread spectrum system. In this transmission
procedure, the frequency range of a data signal is spread use a code uncorrelated with to signal.
16)
Forward link:
To make the signal, data since the entity channels is multiply with the Walsh codes to present the
being forward link channel. The output since this procedure is further multiply with the small PN
code. This provide a means of identify the sector OR cell from which the signal is come for the
handset or mobile
Reverse link:
This channel is use by the mobile phone to communicate among the base location while no
traffic channels have been put up. This channel is hence use for gaining access to the association,
call initiation requests and too for transfer responses to page commands that may be sending by
the network..
You are interested in using the plasmid pGEE as a vector for incorpor.pdfFashionColZone
You are interested in using the plasmid pGEE as a vector for incorporating foreign DNA into E.
coli where it can be cloned. The following plasmid map shows the locations of the recognition
sequence (cut) sites of five different restriction endonucleases, as well as the ORI and a
kanamycin-resistance gene (kan\'). Pick which pair of restriction endonucleases you would use to
digest the plasmid and the foreign DNA. Note: two combinations are equally good. Find them
both.
Solution
BgII and again using BgII would be a suitable choice because two BgII sites are one after the
other and that would cut a considrable amount of vector DNA, and allow foreign DNA to be
inserted. Making two incisions are necessary for foreign DNA to br inserted..
Why animals migrate I need 5 new ideas (exclude reproduction , s.pdfFashionColZone
Why animals migrate ? I need 5 new ideas (exclude : reproduction , seasons/cycle , gene flow ,
climate change and circumstantial)
Solution
Animals migrate in search of food, strength of selection, fecundity, interspecific competition, and
will adapting themselves depend upon phenotypic variation. Some animals migrate for more
livable conditions. They also move to find a place to hibernate. Migration is a behavioral
adaptation, it helps animals survive over time..
Which of the following characteristics of the fetus distinguishes it.pdfFashionColZone
Which of the following characteristics of the fetus distinguishes it from the embryo? Select one:
a. Blood cells form and fill primitive blood vessels.
b. The primitive streak appears.
c. Bone replaces the softer cartilage.
d. The specialization of one group of cells causes adjacent groups of cells to specialize.
Solution
D. The specialization of one group of cells causes adjacent groups of cells to specialize.
this is called differentiation of cells.
What are the major sources of cash (inflows) in a statement of cash .pdfFashionColZone
What are the major sources of cash (inflows) in a statement of cash flows? What are the major
uses (outflows) of cash?
Solution
While preparing a cash flow statement, the cash flows were bifurcated into 3 types. The
following are the 3 types of cash flows:
Major Sources of Cash Flows (Inflows) in a Cash Flow Statement:
1.Major Cash Inflows from Operating Activities:
2.Major Cash Inflows from Investing Activities:
3.Major Cash Inflows from Financing Activities:
Major Sources of Cash Flows (Inflows) in a Cash Flow Statement:
1.Major Cash Outflows from Operating Activities:
2.Major Cash Outflows from Investing Activities:
3. Major Cash Outflows from Financing Activities:
The above mentioned were the major sources and uses of cash flows in a statement of cash
flows..
TYPES OF AUDIT1. Is there an internal audit function within your o.pdfFashionColZone
TYPES OF AUDIT
1. Is there an internal audit function within your organisation? What is its role and how
do you view it?
2. Is there an external auditor for your organisation? What functions does the auditor
carry out and how do you view it?
Solution
Is there an internal audit function within your organisation? What is its role and how do you
view it?
ANSWER: YES, my organisation has an internal audit function. My company is small; and a
small business simply cannot afford employee fraud, government fine or a waste. Thus,
establishment of an internal audit function provides a vital step in the growth of a small
organisation. It\'role ncludes reviewing, assessment, and reporting the condition of the internal
controls in a company thus is beneficial in improvement and maintenance of the internal controls
in the company. It targets to reduce the opportunity for the fraudster, and also the management
will have no or little opportunity to conduct fraud in the company. Moreover is helpful in
findings the weaknesses and giving recommendations for the improvement in the internal
controls.
In my views internal audit function is important to my organisation as protect and enhance
organisational value by providing risk-based and objective assurance, insight and advice..
The total exergy is an extensive property of a system. True or False.pdfFashionColZone
The total exergy is an extensive property of a system. True or False? Explain.
Solution
True, Total exergy is an extensive property.
Exergy is the energy that is available to be used, it can be transferred like energy or entropy
It is depending on the total size of system, (i.e is mass of system),( not for specific size)
That’s way we called as the extensive property.
1.Define culture. How can culture be conceptionalized Your resp.pdfFashionColZone
1.Define culture. How can culture be conceptionalized?
Your response should be at least 200 words in length. You are required to use at least your
textbook as source material for your response. All sources used, including the textbook, must be
referenced; paraphrased and quoted material must have accompanying citations.
2. Discuss two HR activities in which a multinational firm must engage, which would not be
required in a domestic environment?
Your response should be at least 200 words in length. You are required to use at least your
textbook as source material for your response. All sources used, including the textbook, must be
referenced; paraphrased and quoted material must have accompanying citations.
Solution
1.
There are no definitions which describe the term culture exactly/precisely. Most cases are
accompanied by stereotypes which probably describe a country’s or group’s culture roughly
(best). Alike stereotypes of course just reflect the basics of a culture which might also not always
suit/fit. During the process of adapting to/learning a culture’s specific (secret) niceties in most
cases we get taught and guided by people of our society which know the cultural background like
teachers, friends etc. This means learning in the way groups behave. The most important
influence do have our parents which reach us also the right moral understanding they have
learned as our cultural tradition because you are not born with an understanding of culture.
Culture varies obviously from country to country. If you talk about a nation’s culture there are
often prejudices involved. Which definition or explanation ever is chosen they have all one in
common. And that is – they are all based on personal experiences. This is definitely the best way
to proof and fine out something about a culture. Researcher are depending on firsthand
observation and experiences to understand various types culture. As well as managers, if they
want to be international competitive.
2. Activities that a human resource department must engaged to operate in an international
environment are described below:
1. International Taxation:
Expatriates are subject to international taxation, and often have both domestic and host-country
tax liabilities.
Therefore, tax equalisation policies must be designed to ensure that there is no tax incentive or
disincentive associated with any particular international assignment.
2. International Relocation and Orientation:
Involves arranging for pre-departure training; providing immigration and travel details;
providing housing, shopping, medical care, and recreation and schooling information.
Many of these factors may be a source of anxiety for the expatriate and considerable time and
attention is required to resolve potential problems successfully.
3. Administrative Services:
A multinational firm also needs to provide administrative services for expatriates in the host
countries in which it operates.
Providing administrative e services can oft.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
You will write a multi-interface version of the well-known concentra.pdf
1. You will write a multi-interface version of the well-known concentration game: 1. The game
displays a grid of upper-case letters, with each letter appearing twice. 2. A player has a few
seconds to memorize the letters before they disappear. 3. The player then has to remember where
each pair was located.
line, then MultiConcentration starts with the text interface.
First the new game display will show the user the pairs he/she must guess, in a format similar to
the following example for size = 6
D H B C M I
H G K K A R
C N R E O E
Q O A Q L F
L F J P B G
P D N M I J
Memorize the above grid!
Note that the new game display uses pairs of distinct single uppercase capital letters distributed
at random on a square grid, starting at A and continuing until the grid is full.
This new game display shows for 10 seconds, after which it scrolls out of view. (To scroll it just
write about 25 newlines.) Then the standard game display appears.
The standard game display will look like the following example for size = 6
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
21 32 33 34 35 36
Enter a pair of numbers, or "R" to reset, or "Q" to quit:
reset, or "Q" to quit:
If the player makes an invalid entry (e.g. numbers out of range, number already guessed, no
blank separator, etc.) then a "please reenter" message is printed and the same display is shown
again.
If the player makes a bad guess, then a "Sorry..." message is printed and the same display is
shown again.
If the player enters an "R" for reset, then we start over, that is, the computer calculates a new
set of pairs and shows the new game display again.
If the player enters a "Q" for quit, then the game prints a "Game Over" message and ends.
2. 3.4 Graphic Game Interface
If the player used the "-g" flag on the startup command line then MultiConcentration starts up
with the graphic interface.
You may design the graphic interface as you choose, as long as you use Swing and preserve the
steps in the game as described in the previous section.
One possible graphic interface is shown in Figure 1. In this design the new game display and the
standard game display have been replaced by a grid of buttons. Instead of entering pairs of
numbers, the player clicks on two of the buttons. The "reset" and "quit" commands are given
using a menu. Letters that have been correctly guessed are shown with a pink background color.
Messages to the player are shown in a text area under the grid.
4 GENERAL REQUIREMENTS
4.1 Design Requirements
Design your program with GUI classes, a main class, and Application Logic / Data classes as
described in my overheads on Design for Testability.
Do not use a package statement; name the main class MultiConcentration. (Otherwise the
startup command given in 3.1 would not work.)
You should have at least 5 classes, and not one of them should have more than 40% of the code.
Solution
import java.io.OutputStream;
import java.io.PrintStream;
public class MultiConcentration {
public static boolean gameTestModeEnabled = false;
private static boolean textBasedGame = false;
private static int gridSize = -1;
public static final int LOW_GRID = 2;
public static final int HI_GRID = 7;
private static void usage() {
System.out
.println("Usage: java [-ea] MultiConcentration [-g|-t] gridSize");
System.out.println("-ea for enabling assertions");
System.out.println("-g for a GUI interface");
System.out.println("-t for a text interface");
System.out
3. .printf("gridSize is the number of rows or columns (must be %d to %d) ",
LOW_GRID, HI_GRID);
}
private static boolean validateArguments(String[] args) {
// check for test mode
if (args.length == 1) {
if (args[0].equals("-TEST_MODE")) {
gameTestModeEnabled = true;
return true; // All good
}
}
// check for input arguments
if (args.length < 2) {
System.err.println("Error: Not enough arguments given.");
// not enough args given
return false;
} else {
if (!(args[0].equals("-t") || args[0].equals("-g"))) {
System.err.println("Error: First argument is invalid.");
// mistake in first argument
return false;
}
// set textBasedGame
if (args[0].equals("-t"))
textBasedGame = true;
else
textBasedGame = false;
// check second argument
try {
gridSize = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
System.err.println("Error: Second argument is not a number.");
return false; // not integer
}
// Test grid size
4. if (!(gridSize >= LOW_GRID && gridSize <= HI_GRID)) {
System.err.println("Error: Second argument is not in "
+ LOW_GRID + " <= x <= " + HI_GRID + ".");
return false;
}
return true; // All good
}
}
private static void logMsg(boolean passed, int testCnt) {
if (!passed)
System.out.printf("MultiConcentration.validateArguments MC_"
+ "%03d failed ", testCnt);
else
System.out.printf("MultiConcentration.validateArguments MC_"
+ "%03d passed ", testCnt);
}
private static boolean classTest() {
boolean allPassed = true;
int tstCnt = 1;
String[] testArgs = { "" };
boolean result = validateArguments(testArgs);
if (result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_002 - Test for missing flag character or incorrect flag
// character.
String[] testArgs2 = { "-a", "" };
result = validateArguments(testArgs2);
if (result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_003 - Tests gridSize argument that is less than
// minimum.
testArgs2[0] = "-t";
5. testArgs2[1] = "1";
result = validateArguments(testArgs2);
if (result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_004 - Tests gridSize argument within range, between 2
// and 7 with text GUI.
testArgs2[0] = "-t";
testArgs2[1] = "4";
result = validateArguments(testArgs2);
if (!result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_005 - Tests gridSize argument within range, between 2
// and 7 with graphic GUI.
testArgs2[0] = "-g";
testArgs2[1] = "4";
result = validateArguments(testArgs2);
if (!result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_006 - Tests gridSize argument that is greater than
// maximum.
testArgs2[0] = "-t";
testArgs2[1] = "8";
result = validateArguments(testArgs2);
if (result)
allPassed = false;
logMsg(allPassed, tstCnt++);
allPassed &= true;
// Test Case: MC_007 - Test for extra flag characters.
testArgs2[0] = "-tag";
result = validateArguments(testArgs2);
7. overAllTestResult &= MultiConcentration.systemTests();
if (overAllTestResult)
System.out.println("All tests passed");
else
System.out.println("Some tests failed");
}
public static void main(String[] args) {
// check arguments
if (!validateArguments(args)) {
usage();
System.exit(1);
}
// Test Mode?
if (gameTestModeEnabled) {
// Error if unit tests are run without assertions enabled
boolean assertsEnabled = false;
assert assertsEnabled = true; // intentional side effect
if (!assertsEnabled)
throw new RuntimeException(
"Assertions must be enabled for unit tests");
// disable error output
System.setErr(new PrintStream(new OutputStream() {
public void write(int b) {
}
}));
startClassTests();
} else {
// init and start game
GameController game = new GameController(gridSize, textBasedGame);
game.startGame();
}
}
}
GameConfiguration.java
8. import java.util.Arrays;
public class GameConfiguration {
private char gameMatrix[];
/** currentMatches represents the found current matches of the user */
private boolean currentMatches[];
/** gridSize is the size of the game */
private int gridSize;
public GameConfiguration(int gridSize, char gameMatrix[])
throws NullPointerException, IllegalArgumentException {
if (gameMatrix == null)
throw new NullPointerException("gameMatrix is null");
if (!(gridSize >= MultiConcentration.LOW_GRID && gridSize <=
MultiConcentration.HI_GRID))
throw new IllegalArgumentException("Game size out of range");
if (gameMatrix.length != gridSize * gridSize)
throw new IllegalArgumentException("Game matrix dimension error");
this.gridSize = gridSize;
this.gameMatrix = gameMatrix;
currentMatches = new boolean[gameMatrix.length];
for (int i = 0; i < currentMatches.length; i++) {
currentMatches[i] = false;
}
}
public boolean isValidFieldNumber(int number) {
// out of range?
if (number < 1 || number > gridSize * gridSize) {
return false;
}
// already chosen?
if (currentMatches[number - 1])
return false;
return true;
}
public boolean trySetMatch(int matchPosition1, int matchPosition2)
throws IllegalArgumentException {
if (matchPosition1 <= 0 || matchPosition1 > gameMatrix.length)
9. throw new IllegalArgumentException("matchpos 1 out of range");
else if (matchPosition2 <= 0 || matchPosition2 > gameMatrix.length)
throw new IllegalArgumentException("matchpos 1 out of range");
if (gameMatrix[matchPosition1 - 1] == gameMatrix[matchPosition2 - 1]) {
currentMatches[matchPosition1 - 1] = true;
currentMatches[matchPosition2 - 1] = true;
return true;
} else {
return false;
}
}
public boolean isGameFinished() {
boolean retVal = false;
// Base number of correct answers on length
int numCorrectNeeded = currentMatches.length;
int numCorrectCnt = 0;
// If grid is an odd number of elements, all but one
// correct count indicates game over
if (0 == ((numCorrectNeeded + 1) % 2)) {
numCorrectNeeded--;
}
// count number of matches
for (int i = 0; i < currentMatches.length; i++) {
if (currentMatches[i])
numCorrectCnt++;
}
// Determine if enough matches are true
if (numCorrectCnt == numCorrectNeeded)
retVal = true;
return retVal;
}
/**
* @return the gameMatrix
*/
public char[] getGameMatrix() {
return gameMatrix;
11. // GML2 = {gameMatrix: gameMatrix.length() == gridSize^2}
char GMC1[] = { 'a', 'A', 'B', 'B' }; // {gameMatrix: gameMatrix[X] is
// no capital char}
char GMC2[] = GMN2; // {gameMatrix: gameMatrix[X] is a capital char}
char GMC[][] = { GMC1, GMC2 };
char GMM1[] = GMN2; // {gameMatrix: For every X, there is only one or no
// Y for: gameMatrix[X] = gameMatrix[Y]}
char GMM2[] = { 'A', 'A', 'A', 'B' }; // {gameMatrix: There is a X with
// more than one Y for:
// gameMatrix[X] =
// gameMatrix[Y]}
char GMMC[][] = { GMM1, GMM2 };
/** Test case 1 */
passed = true;
try {
config = new GameConfiguration(GS1, GMN2);
passed = false;
} catch (IllegalArgumentException e) {
}
try {
config = new GameConfiguration(GS2 + 1, GMN2);
passed = false;
} catch (IllegalArgumentException e) {
}
// print message and prepare for next test
logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
/** Test case 2 */
passed = true;
try {
config = new GameConfiguration(GS2, GMN1);
passed = false;
} catch (NullPointerException e) {
}
// print message and prepare for next test
12. logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
/** Test case 3 */
passed = true;
try {
config = new GameConfiguration(GS3, GMN2);
passed = false;
} catch (IllegalArgumentException e) {
}
// print message and prepare for next test
logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
/** Test case 4 */
passed = true;
try {
config = new GameConfiguration(GS2, GMC1);
passed = false;
} catch (IllegalArgumentException e) {
}
// print message and prepare for next test
logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
/** Test case 5 */
passed = true;
try {
config = new GameConfiguration(GS2, GMM2);
passed = false;
} catch (IllegalArgumentException e) {
}
// print message and prepare for next test
logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
13. /** Test case 6 */
passed = true;
config = new GameConfiguration(GS2, GMM1);
// check if object is initialized right
if (config.getCurrentMatches().length != GS2 * GS2)
passed = false;
else {
for (boolean currMatch : config.getCurrentMatches()) {
if (currMatch) {
passed = false;
break;
}
}
}
// print message and prepare for next test
logMsg(passed, "GameConfiguration", testCount, 'C');
overallPassed &= passed;
testCount++;
return overallPassed;
}
private static boolean isValidFieldNumberTest() {
int testCount = 1;
boolean passed = true;
boolean overallPassed = true;
int N1 = -1; // {number: number < 1}
int N2 = 2; // {number: 1 <= number <= gridSize * gridSize}
int N3 = 1000; // {number: number > gridSize * gridSize}
// CM1 = {currentMatches: currentMatches[number] == true}
// CM2 = {currentMatches: currentMatches[number] == false}
/** init test data */
char matrix[] = { 'A', 'A', 'B', 'B' };
GameConfiguration config = new GameConfiguration(2, matrix);
config.trySetMatch(1, 2);
/** Test case 1 */
passed = true;
if (config.isValidFieldNumber(N1))
14. passed = false;
if (config.isValidFieldNumber(N3))
passed = false;
// print message and prepare for next test
logMsg(passed, "isValidFieldNumber", testCount, 'F');
overallPassed &= passed;
testCount++;
/** Test case 2 */
passed = true;
if (config.isValidFieldNumber(N2 + 1) == false)
passed = false;
// print message and prepare for next test
logMsg(passed, "isValidFieldNumber", testCount, 'F');
overallPassed &= passed;
testCount++;
/** Test case 3 */
passed = true;
if (config.isValidFieldNumber(N2) == true)
passed = false;
// print message and prepare for next test
logMsg(passed, "isValidFieldNumber", testCount, 'F');
overallPassed &= passed;
testCount++;
return overallPassed;
}
private static boolean trySetMatchTest() {
int testCount = 1;
boolean passed = true;
boolean overallPassed = true;
int M1_1 = -1; // {matchPosition1: matchPosition1 < 1}
int M1_2 = 1; // {matchPosition1: 1 <= matchPosition1 <= gridSize *
// gridSize}
int M1_3 = 5; // {matchPosition1: matchPosition1 > gridSize * gridSize}
int M2_1 = -1; // {matchPosition2: matchPosition2 < 1}
int M2_2 = 2; // {matchPosition2: 1 <= matchPosition2 <= gridSize *
// gridSize}