Assessment type: Programming Assignment
Purpose: This assessment will allow students to demonstrate their understanding of Java programming and object-oriented concepts, the use of list classes in collection framework, and the use of graphical features using swing and applets. This assessment contributes to learning outcomes c and d.
Assessment topic: Develop Java application based on the given scenario: individual assignment.
Task Details: The context for this assignment (Part 1 and Part 2) is a ‘The WAR- WIN or LOSE Game Development’ for calculating and displaying a WIN or LOSE. This assignment will test a student’s knowledge of and skills in writing application software for a task, understanding the business rules of a particular problem, coding these in a computer program, developing a graphical user interface.
For this assignment, students will use the Java programming language and development will be on the NetBeans IDE platform.
This assignment consists of 2 stages:
Preamble: A new fighting game has been introduced. There are N number of terrorists with each having some strength. There are N soldiers in the game with each having some energy. The energy is used to kill terrorists. The terrorist can be killed only if the energy of the soldier is greater than the strength of the terrorist.
John is playing the game and at a time wants to know if it is possible for him to win the game or not with the given set of energies and strengths of soldiers and terrorists. John wins the game if his soldiers can kill all the terrorists with the allotted energy.
There would be specific number of Soldiers with different Energy levels and specific number of Terrorists with different Strengths. (Important: The value of number of Soldiers and terrorists is as per the last two digits of student ID from the following table.)
|Number of Soldiers and that of Terrorists||Last 2 Digits of your Student ID|
|1) 7 Soldiers and 7 Terrorists||00 to 09|
|2) 8 Soldiers and 8 Terrorists||10 to 19|
|3) 9 Soldiers and 9 Terrorists||20 to 29|
|4) 10 Soldiers and 10 Terrorists||30 to 39|
|5) 11 Soldiers and 11 Terrorists||40 to 49|
|6) 12 Soldiers and 12 Terrorists||50 to 59|
|7) 13 Soldiers and 13 Terrorists||60 to 69|
|8) 5 Soldiers and 5 Terrorists||70 to 79|
|9) 4 Soldiers and 4 Terrorists||80 to 89|
|10) 3 Soldiers and 3 Terrorists||90 to 99|
A worked-up example: Let us assume that there are 6 Soldiers and 6 Terrorists for a scenario. Each Soldier from a given team can fight with only 1 Terrorist from a given team.
Algorithm needs to be developed which would check, if 6 pairs of Soldier and Terrorists (Any 1 Soldier from a Team could be mapped to any 1 Terrorists from a Team) are possible where every Solder can kill that Terrorist. If this is possible then only John would WIN. But, after trying out all the possible mappings of Soldier-Terrorist pairs, even if single Terrorist remains, who could not be killed by corresponding Soldier, then John would LOSE.
The number of Soldiers and Terrorists – 6
The Energies of different Soldiers – 150 789 234 400 452 500
[Soldier1:150, Soldier2:789, Soldier3:234, Soldier4:400, Soldier5:452, Soldier6:500]
The Strengths of different Terrorists - 512 90 343 243 478 112
[Terrorist1:512, Terrorist2:90, Terrorist3:343, Terrorist4:243, Terrorist5:478, Terrorist6:112]
For the given test case, if we shuffle the soldiers and terrorists, we can come up with below mappings where all the terrorists can be killed by respective soldiers.
As all the terrorists can be killed by the corresponding soldiers, John will WIN the game. Thus, the final output is WIN.
Generate the below User Interface and ask the user to enter the data for Soldiers and Terrorists. Java Swing components need to be used to generate the below User Interface.
For Solution, connect with our online professionals NOW!