Write an application in java that tracks information

Assignment Help Computer Engineering
Reference no: EM132192822

Write an application in java that tracks information about monster attacks.

Important: use JOptionPane I/O, not Scanners and System.out, for this lab.

For this lab you will create a MonsterAttack class that represents one monster attack, an AttackMonitor class that aggregates data about attacks, and an MonsterAttackDriver class that instantiates an AttackMonitor.

One of the key functions of AttackMonitor is to read and write data using a text file, but you will complete this part in a future lab. Note that nearly all the methods in AttackMonitor and MonsterAttack will be instance, not static, methods.

Part I - MonsterAttack class

Each object of this class represents information about a single attack. The data on each attack includes an integer attack id, three ints representing the day of the month, the month, and the year of the attack, the name of the monster involved (assume that each attack involves only one monster), the location of the attack (String), and the name of the person reporting the attack (String).

MonsterAttack needs a constructor that sets all the instance fields listed above using its parameters. It should take the three components of the date as a single String in the format MM/DD/YYYY (eg, 01/31/2010). Use String's split method to split this String on the slashes, parse the resulting Strings to ints, and use them to set the values of the month, day, and year.

Monster attack also needs getters and setters for all the data fields and a toString() that uses the instance data to create and return a String similar to this: "Attack # 125: Godzilla attacked Tokyo on 6/25/2009. Reported by Kyohei Yamane."

Part II - AttackMonitor

Create an AttackMonitor class that keeps track of the MonsterAttack objects. It should contain an array list (not an array) of MonsterAttacks and an instance method called monitor() with a menu that allows the user to choose to quit or to do any of the tasks listed below, which must all be implemented in separate methods.

After doing any of these tasks, the program should return to the menu, so that the user can continue working on any series of tasks until he/she chooses to quit. Write instance, not static, methods to do each of the following:

Input information on a MonsterAttack. You will have to parse some of the input Strings to ints. When you have all the data, call the MonsterAttack constructor, using the input data, and add the new attack to the list of attacks.

Create a MonsterAttack using method parameters and add it to the list. In other words, this method will take parameters for the data fields, rather than taking them as user input.

Show the current list of attacks by iterating through the list, calling the toString() of each attack, and outputting the result to a dialog box. Write this method so that the program does not crash if the list is empty.

Choose an attack from the array list and delete it. The easiest way to do this is to call the method that shows the information, then ask the user for the id number of the attack to delete. Use linear search to find the attack with that id and delete it. The id number may not be the same as the index in the list. Make sure the application does not crash if the user enters an id that does not appear in the list.

Part III: MonsterAttackDriver

The driver class should instantiate an AttackMonitor and call its monitor() method.

In order to make the application easier to test, the driver should provide hard coded data on three attacks. Use the data to create the three attacks and add them to the list in the monitor.

Reference no: EM132192822

Questions Cloud

What is net benefit maximizing level of output : a. What is net benefit maximizing level of output? b. What is the total benefit function? c. What is the maximum net benefit?
Write an application that prompts a user for two integers : Write an application that prompts a user for two integers and displays every integer between them.
Determine what process was eliminated : Discuss an example of a company that has employed a Blue Ocean Strategy. What are the value innovations that they delivered to customers?
What are your feelings on protectionist trade policies : Can countries employ other tactics when trying to address the reasons they enlist protectionist trade policies?
Write an application in java that tracks information : Write an application in java that tracks information about monster attacks.
Discuss how social heuristics could be used to an advantage : Discuss how social heuristics could be used to an advantage, both ethically and unethically, in making a case to rebuild new orleans after hurricane katrina.
Development of unions in federal employment : Describe the history and development of unions in federal employment.
Write an algorithm for testing primality : Write an algorithm for testing primality, i.e. given n the algorithm checks if n is a prime.
Prepare a work schedule using the work schedule template : Prepare a work schedule using the work schedule template. What processes need to occur for the marketing team to gain support of other departments to implement.

Reviews

Write a Review

Computer Engineering Questions & Answers

  When would you create a detailed manual with graphics

How do you determine which training vehicles to use with which audiences? When would you use a video or a series of videos to describe a product?

  Write a query to find all small items that are part of other

Suppose a Prolog database exists that gives information about the parts in an automobile engine. Predicates of big, small, and part-of are included.

  Define the terms precision and reliability

Sample Evaluation. Gloria Bush has performed a sampling plan to estimate the number of children per household in her neighborhood.

  Derive the effective memory-access times per instruction

Derive the effective memory-access times per instruction for the write-through and write-back caches separately.

  From your knowledge and experience how are computer

from your knowledge and experience how are computer forensic investigators in todays world of complex technology are

  Write an awk program to print a formatted report of the data

Write an awk program to print a formatted report of the data as well as the total price. Note that the description contains a variable number of words.

  Create a movie where an input picture becomes inverted

Create movie where an input picture becomes inverted. The program should swap the two middle rows of pixels in first frame, then next two rows in second frame.

  Show that the picture that results might not actually be

What is the relationship between the language accepted by FIN and the language accepted by NIF? Why?

  Suggest a significant challenge of applying wsihs to

solutions to hmis issuesnbspnbspplease respond to the followingdetermine the most significant requirement of an

  How could term clustering be used to define clusters

Clusters of documents can be summarized by finding the top terms (words) for the documents in the cluster, e.g., by taking the most frequent k terms.

  Implement the given function using logic gates

Implement the same function using a 16 input multiplexer (74150) only. (Hint: Draw the truth table for Q.)

  Develop an automated case tracking system

You are a systems development consultant who has been approached by a client, a law firm, to develop an automated case tracking system. The first step is to negotiate the project scope.

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