Ask the user to enter the data for soldiers and terrorists

Assignment Help Programming Languages
Reference no: EM132372099

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. This assessment contributes to Learning Outcomes c and d.

Topic: Develop Java application based on the given scenario: individual assignment

Assignment 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,

• Part 1: A simple console program (no GUI)

• Part 2: The same but wrapped in a GUI

The WAR – WIN or LOSE Game Development

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.

Explanation

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.

Soldier

Terrorist

RESULT

500

478

WIN

789

512

WIN

234

112

WIN

400

243

WIN

452

343

WIN

150

90

WIN


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.

The player would enter Energy Levels of Soldiers (as Integers) and Strengths of Terrorists (as Integers). Upon clicking the button captioned Start War, the Algorithm would compute the result either as WIN or LOSE. (As explained in above Explanation section).

The WIN scenario:

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]

Attachment:- Programming Assignment.rar

Reference no: EM132372099

Questions Cloud

What is the recommended screening guidelines and treatment : The 57-year-old patient noted urinary hesitancy and a decrease in the force of his urinary stream for several months. Both had progressively become worse.
Leadership style-poor leader and leadership in your field : This may be an article about a particular leader who is influential, a leadership style, a poor leader, leadership in your field, ethics in your field,
Write a summary on henry hazlitt : Write a Half page summary - Henry Hazlitt and the Failure of Keynesian Economics
Describe the agency mission and vision statements : An agency's mission statement addresses the question of "What do we do?" In essence, the mission statement identifies how the agency will get to where it wants.
Ask the user to enter the data for soldiers and terrorists : ICT104 Program Design and Development Programming-Kings Own Institute-Australia-Ask the user to enter the data for Soldiers and Terrorists
Explain the need of load balancing in today networks : MIT Australia - MN502 Overview of Network Security Assignment - Security in Networked Systems. Explain the need of load balancing in today networks
Describe the strategies for overcoming the barriers : Andre is a health care administrator for a public health agency in a densely populated urban area. His department just received funding to implement.
Train a neural network on the weed seed dataset : Soft Computing Class - Neural Networks - Train a neural network on the Cancer dataset so it's not over or under trained then fill out a short form/report
What is your definition of spiritual care : What is your definition of spiritual care? How does it differ or accord with the description given in the topic readings? Explain. The response must be typed.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program to allow user to enter marks of students

Write a program that allows user to key in marks of students. The number of students is determined by the user at the start of the program.

  Write a program that takes three command-linearguments

Write a program that takes three command-linearguments number operator number and performs the required operation and prints the result on a single complete line in standard output.

  Implement the ping coordinator election algorithm

Implement the Ping Coordinator Election Algorithm and socket programming for inter-process communication - how to compile and run your program

  Write a program that creates a scintillation grid

Write a program that creates a scintillation grid

  Algorithm attributes and their importance.

Write a 2 page research paper (excluding title and reference pages) on algorithm attributes and their importance. Use two resources (Wikipedia sources are not permitted) and list each resource used at the end of the paper in the reference list sec..

  Write a program to help a local stock trading company

Write a program to help a local stock trading company automate its systems. The company invests only in the stock market. At the end of each trading day, the company would like to generate and post the listing of its stocks so that investors can s..

  Display the property tax for n property owners

Write a java application that calculates and displays the property tax for N property owners. N should be declared as a constant and it should be equal to the largest digit of your student ID number

  Create logic for program which contains housekeeping

Create logic for program in pseudocode or flowchart which contains housekeeping, detail loop, and end-of-job modules, and which computes service charge and the original check amount customers owe for writing bad check.

  Write method multiple to determine for pair of integers

Write a method multiple which determines, for pair of integers, whether second integer is a multiple of first. The method must take two integer arguments

  Create test-methods for each operations

Write the methods to pass the tests. A significant portion of your score will be based on the effectiveness and thoroughness of your test-methods.

  Explain multiprogrammed system available in user mode

CPU voltage and frequency or put it to sleep altogether. In a multiprogrammed system should this functionality be available in user mode or only accessible via system call. why or why not?

  Program to display the bonus

product receives a 5% bonus, otherwise, he receives a 4% bonus. Display the bonus, formatted with a dollar sign and two decimal places, in the bonusLabel.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd