SlideShare a Scribd company logo
1 of 3
Download to read offline
import java.util.ArrayList; // import jave array list
import javax.swing.JOptionPane; // import java option pane
// JoptioPane Demo from Class Handouts
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class AttackMonitor {
ArrayListattacks = new ArrayList(); //part I
// should we set it in "private list?
// input function
void input(){
// declare same values from attack class
String Monstername, location, date;
int id;
int Victim_number;
// id monstername, location, date, victim number
id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id: "));
Monstername = JOptionPane.showInputDialog("Enter the monster's name: ");
location = JOptionPane.showInputDialog("Enter the attacked location: ");
date = JOptionPane.showInputDialog("Enter the date: ");
Victim_number = Integer.parseInt(JOptionPane.showInputDialog("Enter the Victim numbers:
"));
//
attack temp = new attack(id,date,Monstername,location,Victim_number); //// id monstername,
location, date, victim number
attacks.add(temp);
} // end function
// display function
void display(){
for (int i= 0; i< attacks.size(); i++){ // keep doing it till i reach attacks time
System.out.println(attacks.get(i));
} // end for
} // end function
// delete function
void delete(){
display();
// get attack id to delete
int id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id of attack to delete"));
int i;
for (i= 0; i
Solution
import java.util.ArrayList; // import jave array list
import javax.swing.JOptionPane; // import java option pane
// JoptioPane Demo from Class Handouts
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class AttackMonitor {
ArrayListattacks = new ArrayList(); //part I
// should we set it in "private list?
// input function
void input(){
// declare same values from attack class
String Monstername, location, date;
int id;
int Victim_number;
// id monstername, location, date, victim number
id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id: "));
Monstername = JOptionPane.showInputDialog("Enter the monster's name: ");
location = JOptionPane.showInputDialog("Enter the attacked location: ");
date = JOptionPane.showInputDialog("Enter the date: ");
Victim_number = Integer.parseInt(JOptionPane.showInputDialog("Enter the Victim numbers:
"));
//
attack temp = new attack(id,date,Monstername,location,Victim_number); //// id monstername,
location, date, victim number
attacks.add(temp);
} // end function
// display function
void display(){
for (int i= 0; i< attacks.size(); i++){ // keep doing it till i reach attacks time
System.out.println(attacks.get(i));
} // end for
} // end function
// delete function
void delete(){
display();
// get attack id to delete
int id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id of attack to delete"));
int i;
for (i= 0; i

More Related Content

More from aparnatiwari291

Event Cash Flow   Assets Claims Income Statement OAIAFA Cash.pdf
    Event Cash Flow   Assets  Claims Income Statement    OAIAFA Cash.pdf    Event Cash Flow   Assets  Claims Income Statement    OAIAFA Cash.pdf
Event Cash Flow   Assets Claims Income Statement OAIAFA Cash.pdf
aparnatiwari291
 
Benzoin and methanol both have an alcohol group, .pdf
                     Benzoin and methanol both have an alcohol group, .pdf                     Benzoin and methanol both have an alcohol group, .pdf
Benzoin and methanol both have an alcohol group, .pdf
aparnatiwari291
 
There are 37 classes in java.lang package as per Java SE7 The java.pdf
There are 37 classes in java.lang package as per Java SE7 The java.pdfThere are 37 classes in java.lang package as per Java SE7 The java.pdf
There are 37 classes in java.lang package as per Java SE7 The java.pdf
aparnatiwari291
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
aparnatiwari291
 

More from aparnatiwari291 (20)

When two data sets are pooled together the pooled mean will alway.pdf
 When two data sets are pooled together the pooled mean will alway.pdf When two data sets are pooled together the pooled mean will alway.pdf
When two data sets are pooled together the pooled mean will alway.pdf
 
DELTOID flexes and medially rotates arm; prime mover of arm abduct.pdf
  DELTOID  flexes and medially rotates arm; prime mover of arm abduct.pdf  DELTOID  flexes and medially rotates arm; prime mover of arm abduct.pdf
DELTOID flexes and medially rotates arm; prime mover of arm abduct.pdf
 
Event Cash Flow   Assets Claims Income Statement OAIAFA Cash.pdf
    Event Cash Flow   Assets  Claims Income Statement    OAIAFA Cash.pdf    Event Cash Flow   Assets  Claims Income Statement    OAIAFA Cash.pdf
Event Cash Flow   Assets Claims Income Statement OAIAFA Cash.pdf
 
We know that Molarity = No . of moles Volume of.pdf
                     We know that Molarity = No . of moles  Volume of.pdf                     We know that Molarity = No . of moles  Volume of.pdf
We know that Molarity = No . of moles Volume of.pdf
 
there are no molecules given..pls repost and post.pdf
                     there are no molecules given..pls repost and post.pdf                     there are no molecules given..pls repost and post.pdf
there are no molecules given..pls repost and post.pdf
 
The false statement is Oxygen forms binary compou.pdf
                     The false statement is Oxygen forms binary compou.pdf                     The false statement is Oxygen forms binary compou.pdf
The false statement is Oxygen forms binary compou.pdf
 
the concentration is 0.1550 .pdf
                     the concentration is 0.1550                      .pdf                     the concentration is 0.1550                      .pdf
the concentration is 0.1550 .pdf
 
The area is how many Hydrogens are on the graph. .pdf
                     The area is how many Hydrogens are on the graph. .pdf                     The area is how many Hydrogens are on the graph. .pdf
The area is how many Hydrogens are on the graph. .pdf
 
SO4{2-} (aq) + Sn{2+} (aq) + 4 H{+} (aq)=========.pdf
                     SO4{2-} (aq) + Sn{2+} (aq) + 4 H{+} (aq)=========.pdf                     SO4{2-} (aq) + Sn{2+} (aq) + 4 H{+} (aq)=========.pdf
SO4{2-} (aq) + Sn{2+} (aq) + 4 H{+} (aq)=========.pdf
 
oxygen double bond oxygen .pdf
                     oxygen double bond oxygen                        .pdf                     oxygen double bond oxygen                        .pdf
oxygen double bond oxygen .pdf
 
Once HCl is added in solution, the ions would dis.pdf
                     Once HCl is added in solution, the ions would dis.pdf                     Once HCl is added in solution, the ions would dis.pdf
Once HCl is added in solution, the ions would dis.pdf
 
its e1 OMe attacks at 3-position by transfer of a.pdf
                     its e1 OMe attacks at 3-position by transfer of a.pdf                     its e1 OMe attacks at 3-position by transfer of a.pdf
its e1 OMe attacks at 3-position by transfer of a.pdf
 
H and F are identical, you just need to rotate H .pdf
                     H and F are identical, you just need to rotate H .pdf                     H and F are identical, you just need to rotate H .pdf
H and F are identical, you just need to rotate H .pdf
 
From weakest to strongest A, B, C Butanal is an .pdf
                     From weakest to strongest A, B, C Butanal is an .pdf                     From weakest to strongest A, B, C Butanal is an .pdf
From weakest to strongest A, B, C Butanal is an .pdf
 
Effusion is inversely proportional to the mass. .pdf
                     Effusion is inversely proportional to the mass.  .pdf                     Effusion is inversely proportional to the mass.  .pdf
Effusion is inversely proportional to the mass. .pdf
 
Benzoin and methanol both have an alcohol group, .pdf
                     Benzoin and methanol both have an alcohol group, .pdf                     Benzoin and methanol both have an alcohol group, .pdf
Benzoin and methanol both have an alcohol group, .pdf
 
When acid and base react together they form salt and water.This reac.pdf
When acid and base react together they form salt and water.This reac.pdfWhen acid and base react together they form salt and water.This reac.pdf
When acid and base react together they form salt and water.This reac.pdf
 
There are 37 classes in java.lang package as per Java SE7 The java.pdf
There are 37 classes in java.lang package as per Java SE7 The java.pdfThere are 37 classes in java.lang package as per Java SE7 The java.pdf
There are 37 classes in java.lang package as per Java SE7 The java.pdf
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
 
The precations to be given to the workers areSolutionThe prec.pdf
The precations to be given to the workers areSolutionThe prec.pdfThe precations to be given to the workers areSolutionThe prec.pdf
The precations to be given to the workers areSolutionThe prec.pdf
 

Recently uploaded

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 

import java.util.ArrayList; import jave array list import javax.pdf

  • 1. import java.util.ArrayList; // import jave array list import javax.swing.JOptionPane; // import java option pane // JoptioPane Demo from Class Handouts import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class AttackMonitor { ArrayListattacks = new ArrayList(); //part I // should we set it in "private list? // input function void input(){ // declare same values from attack class String Monstername, location, date; int id; int Victim_number; // id monstername, location, date, victim number id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id: ")); Monstername = JOptionPane.showInputDialog("Enter the monster's name: "); location = JOptionPane.showInputDialog("Enter the attacked location: "); date = JOptionPane.showInputDialog("Enter the date: "); Victim_number = Integer.parseInt(JOptionPane.showInputDialog("Enter the Victim numbers: ")); // attack temp = new attack(id,date,Monstername,location,Victim_number); //// id monstername, location, date, victim number attacks.add(temp); } // end function // display function void display(){ for (int i= 0; i< attacks.size(); i++){ // keep doing it till i reach attacks time System.out.println(attacks.get(i));
  • 2. } // end for } // end function // delete function void delete(){ display(); // get attack id to delete int id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id of attack to delete")); int i; for (i= 0; i Solution import java.util.ArrayList; // import jave array list import javax.swing.JOptionPane; // import java option pane // JoptioPane Demo from Class Handouts import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class AttackMonitor { ArrayListattacks = new ArrayList(); //part I // should we set it in "private list? // input function void input(){ // declare same values from attack class String Monstername, location, date; int id; int Victim_number; // id monstername, location, date, victim number id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id: ")); Monstername = JOptionPane.showInputDialog("Enter the monster's name: "); location = JOptionPane.showInputDialog("Enter the attacked location: "); date = JOptionPane.showInputDialog("Enter the date: ");
  • 3. Victim_number = Integer.parseInt(JOptionPane.showInputDialog("Enter the Victim numbers: ")); // attack temp = new attack(id,date,Monstername,location,Victim_number); //// id monstername, location, date, victim number attacks.add(temp); } // end function // display function void display(){ for (int i= 0; i< attacks.size(); i++){ // keep doing it till i reach attacks time System.out.println(attacks.get(i)); } // end for } // end function // delete function void delete(){ display(); // get attack id to delete int id = Integer.parseInt(JOptionPane.showInputDialog("Enter the id of attack to delete")); int i; for (i= 0; i