Complete the Monster Attack project by doing the following:
In place of the driver used in homework 2, add a menu with aloop and switch. The user must be able to add attacks, get a reporton existing attacks, sve a file, retrieve a file, and clear thelist as many times as she wants in any order she wants.
Replace the array of MonsterAttacks with an ArrayList ofMonsterAttacks. This will require changes in several methods. Youwill need to be able to handle any number of MonsterAttacks theuser chooses to input.
Add a method to AttackMonitor that saves the list of attacks toa comma separated values file. Iterate through the list, and foreach attack, get each field using the getters from MonsterAttack.Write each value to the file, following each one except the lastwith a comma. Save the date as a single String in the formatMM/DD/YYYY. After you have written out all the data for one attack,write out a newline. Add an item to the main menu that calls thismethod.
Add a method that clears the list of monster attacks, then usesa Scanner to read data from a .csv file, uses it to instantiateMonsterAttack objects, and adds the attacks to the list. Thismethod must be able to read the files you write out in the methoddescribed above. You will need to use String's split() method here.Add an item to the main menu that calls this method. Make sure youcan input attack data, save to a file, quit the program, start theprogram again, read your output file, and show the data from thefile.
this is in java code
AttackMonster.java
import java.util.Scanner;
import java.util.Date;
public class AttackMonster {
public MonsterAttack[] attacks;
public void reportAttacks() {
this.attacks = new MonsterAttack[5];
int i;
Scanner scan;
for(i=0; i<5; i++) {
scan = new Scanner(System.in);
System.out.print(\"Enter the name of the monster: \");
String m = scan.nextLine();
System.out.print(\"Enter location of attack: \");
String l = scan.nextLine();
System.out.print(\"Enter amount of damage: \");
double dam = scan.nextDouble();
System.out.print(\"Enter date of attack: \");
int d = scan.nextInt();
System.out.print(\"Enter month of attack: \");
int mon = scan.nextInt();
System.out.print(\"Enter year of attack: \");
int y = scan.nextInt();
@SuppressWarnings(\"deprecation\")
Date date = new Date(d, mon, y);
MonsterAttack ma = new MonsterAttack(m,l, dam, date);
attacks[i] = ma;
} //End of for
}
 Â
public void showAttacks() {
int i;
for(i=0; i<5; i++) {
System.out.println(this.attacks[i].toString());
}
}
 Â
public void calculateDamages() {
double mean=0.0;
int i;
for(i=0; i mean = this.attacks[i].damagesInMillionUSD;
}
mean = mean/this.attacks.length;
System.out.println(\"Mean damages of attacks in millions USD: \" +mean);
}
 Â
public void showMonsters() {
for(MonsterAttack ma: this.attacks) {
System.out.println(ma.getMonsterName());
}
}
 Â
public void getEarliestAttack() {
MonsterAttack m = this.attacks[0];
for(MonsterAttack ma: this.attacks) {
if(m.getDate().after(ma.getDate())) {
m = ma;
}
}
System.out.println(\"Earliest attack: \n\" + m.toString());
}
}
MonsterAttack.java
import java.util.Date;
public class MonsterAttack {
String monsterName;
String attackLocation;
double damagesInMillionUSD;
Date date;
public MonsterAttack(String monsterName, String attackLocation,double damagesInMillionUSD, Date date) {
super();
this.monsterName = monsterName;
this.attackLocation = attackLocation;
this.damagesInMillionUSD = damagesInMillionUSD;
this.date = date;
}
/**
* return the monsterName
*/
public String getMonsterName() {
return monsterName;
}
/**
* param monsterName the monsterName to set
*/
public void setMonsterName(String monsterName) {
this.monsterName = monsterName;
}
/**
* return the attackLocation
*/
public String getAttackLocation() {
return attackLocation;
}
/**
* param attackLocation the attackLocation to set
*/
public void setAttackLocation(String attackLocation) {
this.attackLocation = attackLocation;
}
/**
* return the damagesInMillionUSD
*/
public double getDamagesInMillionUSD() {
return damagesInMillionUSD;
}
/**
* \param damagesInMillionUSD the damagesInMillionUSD to set
*/
public void setDamagesInMillionUSD(double damagesInMillionUSD){
this.damagesInMillionUSD = damagesInMillionUSD;
}
/**
* return the date
*/
public Date getDate() {
return date;
}
/**
* param date the date to set
*/
public void setDate(Date date) {
this.date = date;
}
public String toString() {
String str = \"Monster name: \" + this.monsterName+
\" Attack Location: \" + this.attackLocation+
\" Damage in millions USD : \" + this.damagesInMillionUSD+
\" Date of attack: \" + this.date;
return str;
}
}
MonsterDriver.java
public class MonsterDriver {
  public static void main(String[] args) {
     AttackMonster am = newAttackMonster();
     am.reportAttacks();
am.showAttacks();
am.showMonsters();
am.calculateDamages();
am.getEarliestAttack();
}
  }
This was part 1 to code the first part: Please help measap
Part A
Create a MonsterAttack class. MonsterAttack has the followingprivate data variables. Think about the correct data type to usefor each variable:
monsterName (eg Godzilla)
attackLocation (eg Tokyo)
damagesInMillionUSD (eg 123.45)
date (eg October 27, 1954, OK to use the Java Date class)
Create whatever constructors, getters, and setters you need. Besure to write a reasonable toString().
Part B
Create an AttackMonitor class. AttackMonitor contains an arrayof Monster attacks and has methods to generate reports on theattacks. It should include at least these methods:
reportAttacks() creates an array of five attacks, takes userinput using a Scanner from System.in, creates the attacks(instances of MonsterAttack), and adds the attacks to thearray.
showAttacks() iterates through the array and prints out theresult of running the toString() of each attack.
showDamages() calculates and prints the total amount of damagesfor all attacks and the mean damages
showMonsters() shows the names of all monsters involved in theattacks and the number of attacks for each monster (ie: \"Godzilla,3 attack(s); Bigfoot, 1 attack(s); Yeti: 1 attack(s)). Since we maydiscover new monsters after compile time, you must find the namesusing a getter in MonsterAttack. Don't hard- code the monsternames.
findEarliestAttack() prints out the to String() of the earliestMonsterAttack in the array.
A menu method that offers the user the opportunity to run any ofthe methods listed above or to quit. The menu must be contained ina loop with a swtich statement, as shown in several lectureexamples.. The user can do any of the above tasks in any order, asmany times as she wants to.
Part C
Write a main() method for AttackMonitor. Think about what itneeds to do to show that the other classes work correctly. Thedriver should only call methods from AttackMonitor, not methodsfrom MonsterAttack.
what else do you need ? i Have provided with all the info just makethe adjustments from what its askinf at first to the code Iposted