Question: Can someone please give me the code for part B please. The code for part A was : public class Main { public static void

Can someone please give me the code for part B please. The code for part A was :
public class Main
{
public static void main(String[] args)
{
World world = new World();
world.run();
}
}
-------------------------------------------------------------------------------------------------------
public class Player
{
private static int count;
private String name;
private int unplacedArmies;
public Player()
{
count++;
System.out.print("Enter player " + count + "'s name: ");
this.name = World.keyboard.nextLine();
unplacedArmies = 3;
}
public String toString()
{
return name;
}
public void placeArmies(int armies, Territory territory)
{
unplacedArmies -= armies;
territory.placeArmies(this, armies);
}
}
---------------------------------------------------------------------------------------------------
public class Territory
{
private int row;
private int column;
private Player owner;
private int armies;
public Territory(int column, int row)
{
this.column = column;
this.row = row;
}
public String toString()
{
return "[" + column + "," + row + "]" + owner + "(" + armies + ")";
}
public void placeArmies(Player owner, int armies)
{
this.owner = owner;
this.armies += armies;
}
}
-----------------------------------------------------------------------------------------------
import java.util.Scanner;
public class World
{
public static final Scanner keyboard = new Scanner(System.in);
private Territory territory1;
private Territory territory2;
private Territory territory3;
private Territory territory4;
private Player player1;
private Player player2;
public World()
{
territory1 = new Territory(0, 0);
territory2 = new Territory(1, 0);
territory3 = new Territory(0, 1);
territory4 = new Territory(1, 1);
player1 = new Player();
player2 = new Player();
}
public String toString()
{
return territory1 + " " + territory2 + " " + territory3 + " " + territory4;
}
public void placeArmies(Player player, Territory territory)
{
System.out.print("How many armies would you like to place on " + territory + "? ");
int armies = keyboard.nextInt();
player.placeArmies(armies, territory);
System.out.println(this);
}
public void run()
{
System.out.println(player1 + ", please place your armies");
System.out.println(this);
placeArmies(player1, territory1);
placeArmies(player1, territory2);
System.out.println(player2 + ", please place your armies");
System.out.println(this);
placeArmies(player2, territory3);
placeArmies(player2, territory4);
}
}
 Can someone please give me the code for part B please.
The code for part A was : public class Main { public
static void main(String[] args) { World world = new World(); world.run(); }
} ------------------------------------------------------------------------------------------------------- public class Player { private static int count; private String
name; private int unplacedArmies; public Player() { count++; System.out.print("Enter player " +
count + "'s name: "); this.name = World.keyboard.nextLine(); unplacedArmies = 3; }

310 Part B Due 312 date: 11:59pem on Sunday Ocsober 21, 2018(i.e.21/10/2018, 11:59pm). Value: 21% 3 Topics: Data flow, 00 programming basics, Control fow 314 Objectives: This assignmmt supports objectives 1-5 is Introduction 16 In Part B you wil finish the game that you started building in Part A. You will use your 17 solution to Part A as your starting point 18 Nete!! Your Part B solution should be submitted on PLATEunder the nk "Domination 19 Assignmet Part B 2018 Spring". Be careful not to submit under the link for Part A 20 In your completed game, each player will have anenmating turns until one player has dominated 31 the world (ie. is the owner of all teritories). The first turn of each player involves only ond 22 sp 323 24 However, any turn after the first turn will have more steps 325 326 . Attack territories owned by other players 327 .Place amies 6. Place armies Trane fer armies between the players own territories 328 29 After completing a turn, if the winner has not yet been decided, control trans fers to the net player 330 Tasks 3 Some of the following tasks are divided into a hasic fcature which is necessary to complete 32 beore ccetinuing to the next task, and an "advanced Seature" which will give you extra marks 333 but is not necessary to complete before continuing to the nest task. It is possible to skip 334 advanced feature and come back to it latcr. 33 Task 1: place armies 6 Basic feature 310 Part B Due 312 date: 11:59pem on Sunday Ocsober 21, 2018(i.e.21/10/2018, 11:59pm). Value: 21% 3 Topics: Data flow, 00 programming basics, Control fow 314 Objectives: This assignmmt supports objectives 1-5 is Introduction 16 In Part B you wil finish the game that you started building in Part A. You will use your 17 solution to Part A as your starting point 18 Nete!! Your Part B solution should be submitted on PLATEunder the nk "Domination 19 Assignmet Part B 2018 Spring". Be careful not to submit under the link for Part A 20 In your completed game, each player will have anenmating turns until one player has dominated 31 the world (ie. is the owner of all teritories). The first turn of each player involves only ond 22 sp 323 24 However, any turn after the first turn will have more steps 325 326 . Attack territories owned by other players 327 .Place amies 6. Place armies Trane fer armies between the players own territories 328 29 After completing a turn, if the winner has not yet been decided, control trans fers to the net player 330 Tasks 3 Some of the following tasks are divided into a hasic fcature which is necessary to complete 32 beore ccetinuing to the next task, and an "advanced Seature" which will give you extra marks 333 but is not necessary to complete before continuing to the nest task. It is possible to skip 334 advanced feature and come back to it latcr. 33 Task 1: place armies 6 Basic feature

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!