SlideShare a Scribd company logo
1 of 19
Download to read offline
URGENT
Java
Please updated the already existing Java program and modify it with the steps below:
Where it says ("text file path gets input into here"); in the program link the path instead of that
with a text file with this data in it:
Copy and paste this and use as text file and input the path for the text file where it says "text file
path gets input into here".
2000/Alex/0110/0120/0
2001/Bill/0210/0220/0
2002/Chris/0310/0320/0
2003/Devon/0140/0420/0
2004/Eli/0510/0520/1
2005/Fred/0610/0620/2
2006/Gilbert/0710/0820/3
2007/Herbert/0910/0920/4
2008/Kim/1010/1020/5
###################################################################
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
//setting variables to string or int
public class Storm {
private int stormYear;
private int stormMag;
private String stormStart;
private String stormEnd;
private String stormName;
/**
* Constructor
* Storing all variables from text file
* @param stormName
* @param stormYear
* @param stormStart
* @param stormEnd
* @param stormMag
*/
public Storm(String stormName, int stormYear, String stormStart, String stormEnd, int
stormMag) {
this.stormName = stormName;
this.stormYear = stormYear;
this.stormStart = stormStart;
this.stormEnd = stormEnd;
this.stormMag = stormMag;
}
/**************************************************************/
/*Method: Get and Set */
/*Purpose: They serve to set&get values from class variables */
/*Parameters: */
/*String target: Storm Name */
/*Return: Storm Name */
/**************************************************************/
public String getStormName() {
return stormName;
}
/**
* @param stormName the stormName to set
*/
public void setStormName(String stormName) {
this.stormName = stormName;
}
/**
* @return the stormYear
*/
public int getStormYear() {
return stormYear;
}
/**
* @param stormYear the stormYear to set
*/
public void setStormYear(int stormYear) {
this.stormYear = stormYear;
}
/**
* @return the stormStart
*/
public String getStormStart() {
return stormStart;
}
/**
* @param stormStart the stormStart to set
*/
public void setStormStart(String stormStart) {
this.stormStart = stormStart;
}
//return the stormEnd
public String getStormEnd() {
return stormEnd;
}
//param stormEnd the stormEnd to set
public void setStormEnd(String stormEnd) {
this.stormEnd = stormEnd;
}
//return the stormMag
public int getStormMag() {
return stormMag;
}
/**
* @param stormMag the stormMag to set
*/
public void setStormMag(int stormMag) {
this.stormMag = stormMag;
}
/**************************************************************/
/*Method:String toString */
/*Purpose: convert to a string */
/*Parameters: */
/*String target: Storm Name */
/*Return: Storm Name */
/**************************************************************/
public String toString() {
String s = " " + getStormYear() + "/ " + getStormName() + " " ;
if(getStormMag() == -1){
s= s + "(no info)";
}
else {
if((getStormMag() == 0)){
s = s + "(tropical storm)";
}
else{
s = s + "(hurricane level " + getStormMag() + ")";
}
if(getStormStart().equals("")){
s = s + "(no start)";
}
else{
s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2)+" - " ;
}
if(getStormEnd().equals("")){
s = s + "(no end)" ;
}
else{
s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2);
}
}
return s;
}
}
class Database {
private static final int maxarraysize = 50;
//Attributes
private Storm[] stormArr;
private int add;
/**
* Constructor
* Accepts a file and attempts to read it
* Fills the storm array with the data
*/
public Database(File fileName) {
//Initialize array
this.stormArr = new Storm[maxarraysize];
this.add = 0;
//Scanner to read from the file
Scanner scan = new Scanner(System.in);
try {
scan = new Scanner (new File("text file path gets input into here"));
//Read data from the file
while(scan.hasNextLine()) {
//Year of storm/ Name of storm/ mmdd storm started/ mmdd storm ended/ magnitude of storm
String line = scan.nextLine();
String[] stormdata = line.split("/");
if(stormdata.length < 5)
System.out.println("Database entry not in the correct format: " + line);
//Add data to array
this.stormArr[this.add] = new Storm (stormdata[1],
Integer.parseInt(stormdata[0]),stormdata[2], stormdata[3], Integer.parseInt(stormdata[4]));
this.add += 1;
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
/**
* Returns a storm array which matches the name
*
* @param name
*/
public void getStormsByName(String name) {
boolean found = false;
for (Storm storm : stormArr) {
if((storm != null ) && (storm.getStormName().equalsIgnoreCase(name))) {
found = true;
System.out.print(storm);
}
}
if(!found)
System.out.println(""" + name + "" was not found as a storm name.");
}
/**
* Returns a storm array which matches the year
*
* @param year
*/
public void getStormsByYear(int year) {
boolean found = false;
for (Storm storm : stormArr) {
if((storm != null ) && (storm.getStormYear() == year)) {
found = true;
System.out.print(storm);
}
}
if(!found)
System.out.println(""" + year + "" was not found as a storm year.");
}
/**
* Prints all storm details
*/
public void printAll() {
if(this.stormArr.length == 0)
System.out.println("No data.");
else {
for (Storm storm : stormArr) {
if(storm != null)
System.out.print(storm);
}
}
}
}
class Prog1 {
/**
* Displays a list of commands for user
*/
public static void printCommands() {
System.out.println("Welcome to the CS-102 Storm Tracker Program ");
System.out.println("Current available commands: ");
System.out.println("1. Search for a storm name");
System.out.println("2. Search for a storm year");
System.out.println("3. Print all storms");
System.out.println("4. Exit");
}
public static void main(String args[]) {
File file = new File("text file path gets input into here");
if (!file.exists()) // Check if file is there
System.out.println("file does not exist.");
else {
// Create Database object
Database db = new Database(file);
// Scanner to get user input
Scanner scan = new Scanner(System.in);
// Variable to get user command
int cmd = 0;
//Start
while (true) {
printCommands();
System.out.print("Your choice? ");
cmd = scan.nextInt();
scan.nextLine();
//look up storm name
if (cmd == 1){
System.out.println("Print out storm name: ");
String name = scan.nextLine();
db.getStormsByName(name);
}
//look up storm year
else if (cmd == 2){
System.out.println("Print out storm year: ");
int year = scan.nextInt();
db.getStormsByYear(year);
}
//prints out the data
else if (cmd == 3){
db.printAll();
}
//shuts down program
else if (cmd == 4){
scan.close();
System.exit(0);
}
else {
System.out.println("Please select command 1-4");
}
System.out.println();
}
}
}
} Replace the Database class class with a new implementation which uses a linked list of linked
lists to organize the information within the database. The nodes in the upper-level linked list will
represent years, with one node per year. Each year node will contain a reference to a linked list
of storms for that year. You should maintain the items in each linked list in sorted order, sorting
the upper list by year (in numerical order, low-to-high) and the lower list by name (in standard
dictionary order). You may use any variation on linked lists which you desire; dummy head
nodes, head/end pointers, doubly-linked lists, etc., You may implement additional classes as
desired in order to manage the list. (In particular, consider implementing "Node" classes which
contain links to other objects, such as Movie or Showing objects.) A new command should be
implemented which allows the user to insert a new storm from the main menu line. If selected,
the program should prompt the user for all the necessary information and insert the transaction
into the data structure appropriately. If the user enters a storm whose specified year and name
already appear in the database, the entry should be rejected and the user notified. (Note that the
same name may appear in different years A new command should be implemented which allows
the user to delete a storm. If selected, the program should prompt the user for the year and name
of the storm to be deleted. If a matching storm exists in the database, the user should be asked to
1 confirm the deletion, and appropriate action taken. If no matching storm exists in the database,
the user should be informed of that fact.
Solution
//Tested on Ubuntu,Linux
//I did changes on Database.java and Prog1.java files
/******************Storm.java*************************/
public class Storm {
private int stormYear;
private int stormMag;
private String stormStart;
private String stormEnd;
private String stormName;
/**
* Constructor
* Storing all variables from text file
* @param stormName
* @param stormYear
* @param stormStart
* @param stormEnd
* @param stormMag
*/
public Storm(String stormName, int stormYear, String stormStart, String stormEnd, int
stormMag) {
this.stormName = stormName;
this.stormYear = stormYear;
this.stormStart = stormStart;
this.stormEnd = stormEnd;
this.stormMag = stormMag;
}
/**************************************************************/
/*Method: Get and Set */
/*Purpose: They serve to set&get values from class variables */
/*Parameters: */
/*String target: Storm Name */
/*Return: Storm Name */
/**************************************************************/
public String getStormName() {
return stormName;
}
/**
* @param stormName the stormName to set
*/
public void setStormName(String stormName) {
this.stormName = stormName;
}
/**
* @return the stormYear
*/
public int getStormYear() {
return stormYear;
}
/**
* @param stormYear the stormYear to set
*/
public void setStormYear(int stormYear) {
this.stormYear = stormYear;
}
/**
* @return the stormStart
*/
public String getStormStart() {
return stormStart;
}
/**
* @param stormStart the stormStart to set
*/
public void setStormStart(String stormStart) {
this.stormStart = stormStart;
}
//return the stormEnd
public String getStormEnd() {
return stormEnd;
}
//param stormEnd the stormEnd to set
public void setStormEnd(String stormEnd) {
this.stormEnd = stormEnd;
}
//return the stormMag
public int getStormMag() {
return stormMag;
}
/**
* @param stormMag the stormMag to set
*/
public void setStormMag(int stormMag) {
this.stormMag = stormMag;
}
/**************************************************************/
/*Method:String toString */
/*Purpose: convert to a string */
/*Parameters: */
/*String target: Storm Name */
/*Return: Storm Name */
/**************************************************************/
public String toString() {
String s = " " + getStormYear() + "/ " + getStormName() + " " ;
if(getStormMag() == -1){
s= s + "(no info)";
}
else {
if((getStormMag() == 0)){
s = s + "(tropical storm)";
}
else{
s = s + "(hurricane level " + getStormMag() + ")";
}
if(getStormStart().equals("")){
s = s + "(no start)";
}
else{
s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2)+" - " ;
}
if(getStormEnd().equals("")){
s = s + "(no end)" ;
}
else{
s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2);
}
}
return s;
}
}
/************************Database.java*******************/
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Database {
private static final int maxarraysize = 50;
// Attributes
private Storm[] stormArr;
private int add;
/**
* Constructor Accepts a file and attempts to read it Fills the storm array
* with the data
*/
public Database(File fileName) {
// Initialize array
this.stormArr = new Storm[maxarraysize];
this.add = 0;
// Scanner to read from the file
Scanner scan = new Scanner(System.in);
try {
scan = new Scanner(fileName);
// Read data from the file
while (scan.hasNextLine()) {
// Year of storm/ Name of storm/ mmdd storm started/ mmdd storm
// ended/ magnitude of storm
String line = scan.nextLine();
String[] stormdata = line.split("/");
if (stormdata.length < 5)
System.out.println("Database entry not in the correct format: " + line);
// Add data to array
this.stormArr[this.add] = new Storm(stormdata[1], Integer.parseInt(stormdata[0]),
stormdata[2],
stormdata[3], Integer.parseInt(stormdata[4]));
this.add += 1;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
/**
* Returns a storm array which matches the name
*
* @param name
*/
public void getStormsByName(String name) {
boolean found = false;
for (Storm storm : stormArr) {
if ((storm != null) && (storm.getStormName().equalsIgnoreCase(name))) {
found = true;
System.out.print(storm);
}
}
if (!found)
System.out.println(""" + name + "" was not found as a storm name.");
}
/**
* Returns a storm array which matches the year
*
* @param year
*/
public void getStormsByYear(int year) {
boolean found = false;
for (Storm storm : stormArr) {
if ((storm != null) && (storm.getStormYear() == year)) {
found = true;
System.out.print(storm);
}
}
if (!found)
System.out.println(""" + year + "" was not found as a storm year.");
}
/**
* Prints all storm details
*/
public void printAll() {
if (this.stormArr.length == 0)
System.out.println("No data.");
else {
for (Storm storm : stormArr) {
if (storm != null)
System.out.print(storm);
}
}
}
}
/*************************Prog1.java***************/
import java.io.File;
import java.util.Scanner;
public class Prog1 {
/**
* Displays a list of commands for user
*/
public static void printCommands() {
System.out.println("Welcome to the CS-102 Storm Tracker Program ");
System.out.println("Current available commands: ");
System.out.println("1. Search for a storm name");
System.out.println("2. Search for a storm year");
System.out.println("3. Print all storms");
System.out.println("4. Exit");
}
public static void main(String args[]) {
File file = new File("/home/anshu/Desktop/chegg/input.txt");//ubuntu file path
if (!file.exists()) // Check if file is there
System.out.println("file does not exist.");
else {
// Create Database object
Database db = new Database(file);
// Scanner to get user input
Scanner scan = new Scanner(System.in);
// Variable to get user command
int cmd = 0;
// Start
while (true) {
printCommands();
System.out.print("Your choice? ");
cmd = scan.nextInt();
scan.nextLine();
// look up storm name
if (cmd == 1) {
System.out.println("Print out storm name: ");
String name = scan.nextLine();
db.getStormsByName(name);
}
// look up storm year
else if (cmd == 2) {
System.out.println("Print out storm year: ");
int year = scan.nextInt();
db.getStormsByYear(year);
}
// prints out the data
else if (cmd == 3) {
db.printAll();
}
// shuts down program
else if (cmd == 4) {
scan.close();
System.exit(0);
} else {
System.out.println("Please select command 1-4");
}
System.out.println();
}
}
}
}
/****************************Output**************************/
Welcome to the CS-102 Storm Tracker Program
Current available commands:
1. Search for a storm name
2. Search for a storm year
3. Print all storms
4. Exit
Your choice? 1
Print out storm name:
Alex
2000/ Alex (tropical storm)01/20 - 01/20
Welcome to the CS-102 Storm Tracker Program
Current available commands:
1. Search for a storm name
2. Search for a storm year
3. Print all storms
4. Exit
Your choice? 2
Print out storm year:
2003
2003/ Devon (tropical storm)04/20 - 04/20
Welcome to the CS-102 Storm Tracker Program
Current available commands:
1. Search for a storm name
2. Search for a storm year
3. Print all storms
4. Exit
Your choice? 3
2000/ Alex (tropical storm)01/20 - 01/20
2001/ Bill (tropical storm)02/20 - 02/20
2002/ Chris (tropical storm)03/20 - 03/20
2003/ Devon (tropical storm)04/20 - 04/20
2004/ Eli (hurricane level 1)05/20 - 05/20
2005/ Fred (hurricane level 2)06/20 - 06/20
2006/ Gilbert (hurricane level 3)08/20 - 08/20
2007/ Herbert (hurricane level 4)09/20 - 09/20
2008/ Kim (hurricane level 5)10/20 - 10/20
Welcome to the CS-102 Storm Tracker Program
Current available commands:
1. Search for a storm name
2. Search for a storm year
3. Print all storms
4. Exit
Your choice? 4
/********************content of input.txt******************/
2000/Alex/0110/0120/0
2001/Bill/0210/0220/0
2002/Chris/0310/0320/0
2003/Devon/0140/0420/0
2004/Eli/0510/0520/1
2005/Fred/0610/0620/2
2006/Gilbert/0710/0820/3
2007/Herbert/0910/0920/4
2008/Kim/1010/1020/5
Thanks a lot
If you have any query please feel free and ask

More Related Content

Similar to URGENTJavaPlease updated the already existing Java program and m.pdf

in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfstopgolook
 
[10] Write a Java application which first reads data from the phoneb.pdf
[10] Write a Java application which first reads data from the phoneb.pdf[10] Write a Java application which first reads data from the phoneb.pdf
[10] Write a Java application which first reads data from the phoneb.pdfarchiespink
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile DevelopmentJan Rybák Benetka
 
HELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdfHELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdffatoryoutlets
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfARCHANASTOREKOTA
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfaquadreammail
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfaromanets
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfcontact41
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overviewstn_tkiller
 
Please fix the java code (using eclipse)package hw4p1;import jav.pdf
Please fix the java code (using eclipse)package hw4p1;import jav.pdfPlease fix the java code (using eclipse)package hw4p1;import jav.pdf
Please fix the java code (using eclipse)package hw4p1;import jav.pdfinfo961251
 
Create an implementation of a binary tree using the recursive appr.pdf
Create an implementation of a binary tree using the recursive appr.pdfCreate an implementation of a binary tree using the recursive appr.pdf
Create an implementation of a binary tree using the recursive appr.pdffederaleyecare
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfdbrienmhompsonkath75
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfaioils
 
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdfTask #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdfinfo706022
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfarmyshoes
 
ch06-file-processing.ppt
ch06-file-processing.pptch06-file-processing.ppt
ch06-file-processing.pptMahyuddin8
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfsooryasalini
 

Similar to URGENTJavaPlease updated the already existing Java program and m.pdf (20)

in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdf
 
[10] Write a Java application which first reads data from the phoneb.pdf
[10] Write a Java application which first reads data from the phoneb.pdf[10] Write a Java application which first reads data from the phoneb.pdf
[10] Write a Java application which first reads data from the phoneb.pdf
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
HELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdfHELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdf
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdf
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdfCreat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
Creat Shape classes from scratch DETAILS You will create 3 shape cla.pdf
 
In this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdfIn this lab, we will write an application to store a deck of cards i.pdf
In this lab, we will write an application to store a deck of cards i.pdf
 
Gift-VT Tools Development Overview
Gift-VT Tools Development OverviewGift-VT Tools Development Overview
Gift-VT Tools Development Overview
 
Please fix the java code (using eclipse)package hw4p1;import jav.pdf
Please fix the java code (using eclipse)package hw4p1;import jav.pdfPlease fix the java code (using eclipse)package hw4p1;import jav.pdf
Please fix the java code (using eclipse)package hw4p1;import jav.pdf
 
Create an implementation of a binary tree using the recursive appr.pdf
Create an implementation of a binary tree using the recursive appr.pdfCreate an implementation of a binary tree using the recursive appr.pdf
Create an implementation of a binary tree using the recursive appr.pdf
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
 
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdfTask #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Data structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdfData structuresUsing java language and develop a prot.pdf
Data structuresUsing java language and develop a prot.pdf
 
ch06-file-processing.ppt
ch06-file-processing.pptch06-file-processing.ppt
ch06-file-processing.ppt
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
 

More from erremmfab

One brain area in which neurogenesis is especially apparent is the.pdf
One brain area in which neurogenesis is especially apparent is the.pdfOne brain area in which neurogenesis is especially apparent is the.pdf
One brain area in which neurogenesis is especially apparent is the.pdferremmfab
 
Ive used op amps as comparators a number of times because of the e.pdf
Ive used op amps as comparators a number of times because of the e.pdfIve used op amps as comparators a number of times because of the e.pdf
Ive used op amps as comparators a number of times because of the e.pdferremmfab
 
Is there any reason that mitosis could not occur in a cell whose gen.pdf
Is there any reason that mitosis could not occur in a cell whose gen.pdfIs there any reason that mitosis could not occur in a cell whose gen.pdf
Is there any reason that mitosis could not occur in a cell whose gen.pdferremmfab
 
In fruit flies, the brown gene, which controls eye color, is located .pdf
In fruit flies, the brown gene, which controls eye color, is located .pdfIn fruit flies, the brown gene, which controls eye color, is located .pdf
In fruit flies, the brown gene, which controls eye color, is located .pdferremmfab
 
In a population of Gouldian Finches, 1200 have a white breast colora.pdf
In a population of Gouldian Finches, 1200 have a white breast colora.pdfIn a population of Gouldian Finches, 1200 have a white breast colora.pdf
In a population of Gouldian Finches, 1200 have a white breast colora.pdferremmfab
 
IL 0 Group II Group I Select GP I Select GP II Solution Basic P.pdf
IL 0 Group II Group I Select GP I Select GP II Solution  Basic P.pdfIL 0 Group II Group I Select GP I Select GP II Solution  Basic P.pdf
IL 0 Group II Group I Select GP I Select GP II Solution Basic P.pdferremmfab
 
If noncovalent interactions such as hydrogen bonds are so weak , how.pdf
If noncovalent interactions such as hydrogen bonds are so weak , how.pdfIf noncovalent interactions such as hydrogen bonds are so weak , how.pdf
If noncovalent interactions such as hydrogen bonds are so weak , how.pdferremmfab
 
How is the address of the individual of an array foundSolution.pdf
How is the address of the individual of an array foundSolution.pdfHow is the address of the individual of an array foundSolution.pdf
How is the address of the individual of an array foundSolution.pdferremmfab
 
Given the following information (ignore the top posts on the LEGO br.pdf
Given the following information (ignore the top posts on the LEGO br.pdfGiven the following information (ignore the top posts on the LEGO br.pdf
Given the following information (ignore the top posts on the LEGO br.pdferremmfab
 
Gene Splicing -1. DNA is made up of two separate strands of base s.pdf
Gene Splicing -1. DNA is made up of two separate strands of base s.pdfGene Splicing -1. DNA is made up of two separate strands of base s.pdf
Gene Splicing -1. DNA is made up of two separate strands of base s.pdferremmfab
 
For each of these functions, is it one-to-one Is it onto For each .pdf
For each of these functions, is it one-to-one Is it onto For each .pdfFor each of these functions, is it one-to-one Is it onto For each .pdf
For each of these functions, is it one-to-one Is it onto For each .pdferremmfab
 
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdf
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdfFind all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdf
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdferremmfab
 
Discuss the history of operations, information, systems, and conting.pdf
Discuss the history of operations, information, systems, and conting.pdfDiscuss the history of operations, information, systems, and conting.pdf
Discuss the history of operations, information, systems, and conting.pdferremmfab
 
Dr. Butthead received a new cell line and he wants to see which cult.pdf
Dr. Butthead received a new cell line and he wants to see which cult.pdfDr. Butthead received a new cell line and he wants to see which cult.pdf
Dr. Butthead received a new cell line and he wants to see which cult.pdferremmfab
 
Describe or explain how SNPs in gens at evolutionary conserved break.pdf
Describe or explain how SNPs in gens at evolutionary conserved break.pdfDescribe or explain how SNPs in gens at evolutionary conserved break.pdf
Describe or explain how SNPs in gens at evolutionary conserved break.pdferremmfab
 
create a binary search tree from an empty one by adding the key valu.pdf
create a binary search tree from an empty one by adding the key valu.pdfcreate a binary search tree from an empty one by adding the key valu.pdf
create a binary search tree from an empty one by adding the key valu.pdferremmfab
 
Data Analysis correlation. A correlation R in regression analysis t.pdf
Data Analysis  correlation. A correlation  R in regression analysis t.pdfData Analysis  correlation. A correlation  R in regression analysis t.pdf
Data Analysis correlation. A correlation R in regression analysis t.pdferremmfab
 
Conduct outside reading on Salla disease. Explain its underlying mole.pdf
Conduct outside reading on Salla disease. Explain its underlying mole.pdfConduct outside reading on Salla disease. Explain its underlying mole.pdf
Conduct outside reading on Salla disease. Explain its underlying mole.pdferremmfab
 
Can we accept mobile apps as a part of data communication networks.pdf
Can we accept mobile apps as a part of data communication networks.pdfCan we accept mobile apps as a part of data communication networks.pdf
Can we accept mobile apps as a part of data communication networks.pdferremmfab
 
At absolute temperature T, a black body radiates its peak intensity a.pdf
At absolute temperature T, a black body radiates its peak intensity a.pdfAt absolute temperature T, a black body radiates its peak intensity a.pdf
At absolute temperature T, a black body radiates its peak intensity a.pdferremmfab
 

More from erremmfab (20)

One brain area in which neurogenesis is especially apparent is the.pdf
One brain area in which neurogenesis is especially apparent is the.pdfOne brain area in which neurogenesis is especially apparent is the.pdf
One brain area in which neurogenesis is especially apparent is the.pdf
 
Ive used op amps as comparators a number of times because of the e.pdf
Ive used op amps as comparators a number of times because of the e.pdfIve used op amps as comparators a number of times because of the e.pdf
Ive used op amps as comparators a number of times because of the e.pdf
 
Is there any reason that mitosis could not occur in a cell whose gen.pdf
Is there any reason that mitosis could not occur in a cell whose gen.pdfIs there any reason that mitosis could not occur in a cell whose gen.pdf
Is there any reason that mitosis could not occur in a cell whose gen.pdf
 
In fruit flies, the brown gene, which controls eye color, is located .pdf
In fruit flies, the brown gene, which controls eye color, is located .pdfIn fruit flies, the brown gene, which controls eye color, is located .pdf
In fruit flies, the brown gene, which controls eye color, is located .pdf
 
In a population of Gouldian Finches, 1200 have a white breast colora.pdf
In a population of Gouldian Finches, 1200 have a white breast colora.pdfIn a population of Gouldian Finches, 1200 have a white breast colora.pdf
In a population of Gouldian Finches, 1200 have a white breast colora.pdf
 
IL 0 Group II Group I Select GP I Select GP II Solution Basic P.pdf
IL 0 Group II Group I Select GP I Select GP II Solution  Basic P.pdfIL 0 Group II Group I Select GP I Select GP II Solution  Basic P.pdf
IL 0 Group II Group I Select GP I Select GP II Solution Basic P.pdf
 
If noncovalent interactions such as hydrogen bonds are so weak , how.pdf
If noncovalent interactions such as hydrogen bonds are so weak , how.pdfIf noncovalent interactions such as hydrogen bonds are so weak , how.pdf
If noncovalent interactions such as hydrogen bonds are so weak , how.pdf
 
How is the address of the individual of an array foundSolution.pdf
How is the address of the individual of an array foundSolution.pdfHow is the address of the individual of an array foundSolution.pdf
How is the address of the individual of an array foundSolution.pdf
 
Given the following information (ignore the top posts on the LEGO br.pdf
Given the following information (ignore the top posts on the LEGO br.pdfGiven the following information (ignore the top posts on the LEGO br.pdf
Given the following information (ignore the top posts on the LEGO br.pdf
 
Gene Splicing -1. DNA is made up of two separate strands of base s.pdf
Gene Splicing -1. DNA is made up of two separate strands of base s.pdfGene Splicing -1. DNA is made up of two separate strands of base s.pdf
Gene Splicing -1. DNA is made up of two separate strands of base s.pdf
 
For each of these functions, is it one-to-one Is it onto For each .pdf
For each of these functions, is it one-to-one Is it onto For each .pdfFor each of these functions, is it one-to-one Is it onto For each .pdf
For each of these functions, is it one-to-one Is it onto For each .pdf
 
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdf
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdfFind all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdf
Find all roots of Re(arcsinh(z)) = 0, where z is the complex number,.pdf
 
Discuss the history of operations, information, systems, and conting.pdf
Discuss the history of operations, information, systems, and conting.pdfDiscuss the history of operations, information, systems, and conting.pdf
Discuss the history of operations, information, systems, and conting.pdf
 
Dr. Butthead received a new cell line and he wants to see which cult.pdf
Dr. Butthead received a new cell line and he wants to see which cult.pdfDr. Butthead received a new cell line and he wants to see which cult.pdf
Dr. Butthead received a new cell line and he wants to see which cult.pdf
 
Describe or explain how SNPs in gens at evolutionary conserved break.pdf
Describe or explain how SNPs in gens at evolutionary conserved break.pdfDescribe or explain how SNPs in gens at evolutionary conserved break.pdf
Describe or explain how SNPs in gens at evolutionary conserved break.pdf
 
create a binary search tree from an empty one by adding the key valu.pdf
create a binary search tree from an empty one by adding the key valu.pdfcreate a binary search tree from an empty one by adding the key valu.pdf
create a binary search tree from an empty one by adding the key valu.pdf
 
Data Analysis correlation. A correlation R in regression analysis t.pdf
Data Analysis  correlation. A correlation  R in regression analysis t.pdfData Analysis  correlation. A correlation  R in regression analysis t.pdf
Data Analysis correlation. A correlation R in regression analysis t.pdf
 
Conduct outside reading on Salla disease. Explain its underlying mole.pdf
Conduct outside reading on Salla disease. Explain its underlying mole.pdfConduct outside reading on Salla disease. Explain its underlying mole.pdf
Conduct outside reading on Salla disease. Explain its underlying mole.pdf
 
Can we accept mobile apps as a part of data communication networks.pdf
Can we accept mobile apps as a part of data communication networks.pdfCan we accept mobile apps as a part of data communication networks.pdf
Can we accept mobile apps as a part of data communication networks.pdf
 
At absolute temperature T, a black body radiates its peak intensity a.pdf
At absolute temperature T, a black body radiates its peak intensity a.pdfAt absolute temperature T, a black body radiates its peak intensity a.pdf
At absolute temperature T, a black body radiates its peak intensity a.pdf
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

URGENTJavaPlease updated the already existing Java program and m.pdf

  • 1. URGENT Java Please updated the already existing Java program and modify it with the steps below: Where it says ("text file path gets input into here"); in the program link the path instead of that with a text file with this data in it: Copy and paste this and use as text file and input the path for the text file where it says "text file path gets input into here". 2000/Alex/0110/0120/0 2001/Bill/0210/0220/0 2002/Chris/0310/0320/0 2003/Devon/0140/0420/0 2004/Eli/0510/0520/1 2005/Fred/0610/0620/2 2006/Gilbert/0710/0820/3 2007/Herbert/0910/0920/4 2008/Kim/1010/1020/5 ################################################################### import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; //setting variables to string or int public class Storm { private int stormYear; private int stormMag; private String stormStart; private String stormEnd; private String stormName; /** * Constructor * Storing all variables from text file * @param stormName
  • 2. * @param stormYear * @param stormStart * @param stormEnd * @param stormMag */ public Storm(String stormName, int stormYear, String stormStart, String stormEnd, int stormMag) { this.stormName = stormName; this.stormYear = stormYear; this.stormStart = stormStart; this.stormEnd = stormEnd; this.stormMag = stormMag; } /**************************************************************/ /*Method: Get and Set */ /*Purpose: They serve to set&get values from class variables */ /*Parameters: */ /*String target: Storm Name */ /*Return: Storm Name */ /**************************************************************/ public String getStormName() { return stormName; } /** * @param stormName the stormName to set */ public void setStormName(String stormName) { this.stormName = stormName; } /** * @return the stormYear */
  • 3. public int getStormYear() { return stormYear; } /** * @param stormYear the stormYear to set */ public void setStormYear(int stormYear) { this.stormYear = stormYear; } /** * @return the stormStart */ public String getStormStart() { return stormStart; } /** * @param stormStart the stormStart to set */ public void setStormStart(String stormStart) { this.stormStart = stormStart; } //return the stormEnd public String getStormEnd() { return stormEnd; } //param stormEnd the stormEnd to set public void setStormEnd(String stormEnd) { this.stormEnd = stormEnd; }
  • 4. //return the stormMag public int getStormMag() { return stormMag; } /** * @param stormMag the stormMag to set */ public void setStormMag(int stormMag) { this.stormMag = stormMag; } /**************************************************************/ /*Method:String toString */ /*Purpose: convert to a string */ /*Parameters: */ /*String target: Storm Name */ /*Return: Storm Name */ /**************************************************************/ public String toString() { String s = " " + getStormYear() + "/ " + getStormName() + " " ; if(getStormMag() == -1){ s= s + "(no info)"; } else { if((getStormMag() == 0)){ s = s + "(tropical storm)"; } else{ s = s + "(hurricane level " + getStormMag() + ")"; } if(getStormStart().equals("")){ s = s + "(no start)"; }
  • 5. else{ s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2)+" - " ; } if(getStormEnd().equals("")){ s = s + "(no end)" ; } else{ s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2); } } return s; } } class Database { private static final int maxarraysize = 50; //Attributes private Storm[] stormArr; private int add; /** * Constructor * Accepts a file and attempts to read it * Fills the storm array with the data */ public Database(File fileName) { //Initialize array this.stormArr = new Storm[maxarraysize]; this.add = 0; //Scanner to read from the file Scanner scan = new Scanner(System.in); try { scan = new Scanner (new File("text file path gets input into here"));
  • 6. //Read data from the file while(scan.hasNextLine()) { //Year of storm/ Name of storm/ mmdd storm started/ mmdd storm ended/ magnitude of storm String line = scan.nextLine(); String[] stormdata = line.split("/"); if(stormdata.length < 5) System.out.println("Database entry not in the correct format: " + line); //Add data to array this.stormArr[this.add] = new Storm (stormdata[1], Integer.parseInt(stormdata[0]),stormdata[2], stormdata[3], Integer.parseInt(stormdata[4])); this.add += 1; } } catch (FileNotFoundException e) { e.printStackTrace(); } } /** * Returns a storm array which matches the name * * @param name */ public void getStormsByName(String name) { boolean found = false; for (Storm storm : stormArr) { if((storm != null ) && (storm.getStormName().equalsIgnoreCase(name))) { found = true; System.out.print(storm); } } if(!found) System.out.println(""" + name + "" was not found as a storm name.");
  • 7. } /** * Returns a storm array which matches the year * * @param year */ public void getStormsByYear(int year) { boolean found = false; for (Storm storm : stormArr) { if((storm != null ) && (storm.getStormYear() == year)) { found = true; System.out.print(storm); } } if(!found) System.out.println(""" + year + "" was not found as a storm year."); } /** * Prints all storm details */ public void printAll() { if(this.stormArr.length == 0) System.out.println("No data."); else { for (Storm storm : stormArr) { if(storm != null) System.out.print(storm); } } } }
  • 8. class Prog1 { /** * Displays a list of commands for user */ public static void printCommands() { System.out.println("Welcome to the CS-102 Storm Tracker Program "); System.out.println("Current available commands: "); System.out.println("1. Search for a storm name"); System.out.println("2. Search for a storm year"); System.out.println("3. Print all storms"); System.out.println("4. Exit"); } public static void main(String args[]) { File file = new File("text file path gets input into here"); if (!file.exists()) // Check if file is there System.out.println("file does not exist."); else { // Create Database object Database db = new Database(file); // Scanner to get user input Scanner scan = new Scanner(System.in); // Variable to get user command int cmd = 0; //Start while (true) { printCommands(); System.out.print("Your choice? "); cmd = scan.nextInt(); scan.nextLine(); //look up storm name if (cmd == 1){
  • 9. System.out.println("Print out storm name: "); String name = scan.nextLine(); db.getStormsByName(name); } //look up storm year else if (cmd == 2){ System.out.println("Print out storm year: "); int year = scan.nextInt(); db.getStormsByYear(year); } //prints out the data else if (cmd == 3){ db.printAll(); } //shuts down program else if (cmd == 4){ scan.close(); System.exit(0); } else { System.out.println("Please select command 1-4"); } System.out.println(); } } } } Replace the Database class class with a new implementation which uses a linked list of linked lists to organize the information within the database. The nodes in the upper-level linked list will represent years, with one node per year. Each year node will contain a reference to a linked list of storms for that year. You should maintain the items in each linked list in sorted order, sorting the upper list by year (in numerical order, low-to-high) and the lower list by name (in standard dictionary order). You may use any variation on linked lists which you desire; dummy head nodes, head/end pointers, doubly-linked lists, etc., You may implement additional classes as desired in order to manage the list. (In particular, consider implementing "Node" classes which contain links to other objects, such as Movie or Showing objects.) A new command should be implemented which allows the user to insert a new storm from the main menu line. If selected,
  • 10. the program should prompt the user for all the necessary information and insert the transaction into the data structure appropriately. If the user enters a storm whose specified year and name already appear in the database, the entry should be rejected and the user notified. (Note that the same name may appear in different years A new command should be implemented which allows the user to delete a storm. If selected, the program should prompt the user for the year and name of the storm to be deleted. If a matching storm exists in the database, the user should be asked to 1 confirm the deletion, and appropriate action taken. If no matching storm exists in the database, the user should be informed of that fact. Solution //Tested on Ubuntu,Linux //I did changes on Database.java and Prog1.java files /******************Storm.java*************************/ public class Storm { private int stormYear; private int stormMag; private String stormStart; private String stormEnd; private String stormName; /** * Constructor * Storing all variables from text file * @param stormName * @param stormYear * @param stormStart * @param stormEnd * @param stormMag */ public Storm(String stormName, int stormYear, String stormStart, String stormEnd, int stormMag) { this.stormName = stormName; this.stormYear = stormYear; this.stormStart = stormStart; this.stormEnd = stormEnd;
  • 11. this.stormMag = stormMag; } /**************************************************************/ /*Method: Get and Set */ /*Purpose: They serve to set&get values from class variables */ /*Parameters: */ /*String target: Storm Name */ /*Return: Storm Name */ /**************************************************************/ public String getStormName() { return stormName; } /** * @param stormName the stormName to set */ public void setStormName(String stormName) { this.stormName = stormName; } /** * @return the stormYear */ public int getStormYear() { return stormYear; } /** * @param stormYear the stormYear to set */ public void setStormYear(int stormYear) { this.stormYear = stormYear; } /** * @return the stormStart */ public String getStormStart() { return stormStart;
  • 12. } /** * @param stormStart the stormStart to set */ public void setStormStart(String stormStart) { this.stormStart = stormStart; } //return the stormEnd public String getStormEnd() { return stormEnd; } //param stormEnd the stormEnd to set public void setStormEnd(String stormEnd) { this.stormEnd = stormEnd; } //return the stormMag public int getStormMag() { return stormMag; } /** * @param stormMag the stormMag to set */ public void setStormMag(int stormMag) { this.stormMag = stormMag; } /**************************************************************/ /*Method:String toString */ /*Purpose: convert to a string */ /*Parameters: */ /*String target: Storm Name */ /*Return: Storm Name */ /**************************************************************/ public String toString() {
  • 13. String s = " " + getStormYear() + "/ " + getStormName() + " " ; if(getStormMag() == -1){ s= s + "(no info)"; } else { if((getStormMag() == 0)){ s = s + "(tropical storm)"; } else{ s = s + "(hurricane level " + getStormMag() + ")"; } if(getStormStart().equals("")){ s = s + "(no start)"; } else{ s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2)+" - " ; } if(getStormEnd().equals("")){ s = s + "(no end)" ; } else{ s = s + getStormEnd().substring(0, 2) + "/" + getStormEnd().substring(2); } } return s; } } /************************Database.java*******************/ import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Database { private static final int maxarraysize = 50; // Attributes
  • 14. private Storm[] stormArr; private int add; /** * Constructor Accepts a file and attempts to read it Fills the storm array * with the data */ public Database(File fileName) { // Initialize array this.stormArr = new Storm[maxarraysize]; this.add = 0; // Scanner to read from the file Scanner scan = new Scanner(System.in); try { scan = new Scanner(fileName); // Read data from the file while (scan.hasNextLine()) { // Year of storm/ Name of storm/ mmdd storm started/ mmdd storm // ended/ magnitude of storm String line = scan.nextLine(); String[] stormdata = line.split("/"); if (stormdata.length < 5) System.out.println("Database entry not in the correct format: " + line); // Add data to array this.stormArr[this.add] = new Storm(stormdata[1], Integer.parseInt(stormdata[0]), stormdata[2], stormdata[3], Integer.parseInt(stormdata[4])); this.add += 1; } } catch (FileNotFoundException e) { e.printStackTrace(); } } /** * Returns a storm array which matches the name * * @param name
  • 15. */ public void getStormsByName(String name) { boolean found = false; for (Storm storm : stormArr) { if ((storm != null) && (storm.getStormName().equalsIgnoreCase(name))) { found = true; System.out.print(storm); } } if (!found) System.out.println(""" + name + "" was not found as a storm name."); } /** * Returns a storm array which matches the year * * @param year */ public void getStormsByYear(int year) { boolean found = false; for (Storm storm : stormArr) { if ((storm != null) && (storm.getStormYear() == year)) { found = true; System.out.print(storm); } } if (!found) System.out.println(""" + year + "" was not found as a storm year."); } /** * Prints all storm details */ public void printAll() { if (this.stormArr.length == 0) System.out.println("No data."); else { for (Storm storm : stormArr) {
  • 16. if (storm != null) System.out.print(storm); } } } } /*************************Prog1.java***************/ import java.io.File; import java.util.Scanner; public class Prog1 { /** * Displays a list of commands for user */ public static void printCommands() { System.out.println("Welcome to the CS-102 Storm Tracker Program "); System.out.println("Current available commands: "); System.out.println("1. Search for a storm name"); System.out.println("2. Search for a storm year"); System.out.println("3. Print all storms"); System.out.println("4. Exit"); } public static void main(String args[]) { File file = new File("/home/anshu/Desktop/chegg/input.txt");//ubuntu file path if (!file.exists()) // Check if file is there System.out.println("file does not exist."); else { // Create Database object Database db = new Database(file); // Scanner to get user input Scanner scan = new Scanner(System.in); // Variable to get user command int cmd = 0; // Start while (true) { printCommands();
  • 17. System.out.print("Your choice? "); cmd = scan.nextInt(); scan.nextLine(); // look up storm name if (cmd == 1) { System.out.println("Print out storm name: "); String name = scan.nextLine(); db.getStormsByName(name); } // look up storm year else if (cmd == 2) { System.out.println("Print out storm year: "); int year = scan.nextInt(); db.getStormsByYear(year); } // prints out the data else if (cmd == 3) { db.printAll(); } // shuts down program else if (cmd == 4) { scan.close(); System.exit(0); } else { System.out.println("Please select command 1-4"); } System.out.println(); } } } } /****************************Output**************************/ Welcome to the CS-102 Storm Tracker Program Current available commands: 1. Search for a storm name
  • 18. 2. Search for a storm year 3. Print all storms 4. Exit Your choice? 1 Print out storm name: Alex 2000/ Alex (tropical storm)01/20 - 01/20 Welcome to the CS-102 Storm Tracker Program Current available commands: 1. Search for a storm name 2. Search for a storm year 3. Print all storms 4. Exit Your choice? 2 Print out storm year: 2003 2003/ Devon (tropical storm)04/20 - 04/20 Welcome to the CS-102 Storm Tracker Program Current available commands: 1. Search for a storm name 2. Search for a storm year 3. Print all storms 4. Exit Your choice? 3 2000/ Alex (tropical storm)01/20 - 01/20 2001/ Bill (tropical storm)02/20 - 02/20 2002/ Chris (tropical storm)03/20 - 03/20 2003/ Devon (tropical storm)04/20 - 04/20 2004/ Eli (hurricane level 1)05/20 - 05/20 2005/ Fred (hurricane level 2)06/20 - 06/20 2006/ Gilbert (hurricane level 3)08/20 - 08/20 2007/ Herbert (hurricane level 4)09/20 - 09/20 2008/ Kim (hurricane level 5)10/20 - 10/20 Welcome to the CS-102 Storm Tracker Program Current available commands: 1. Search for a storm name
  • 19. 2. Search for a storm year 3. Print all storms 4. Exit Your choice? 4 /********************content of input.txt******************/ 2000/Alex/0110/0120/0 2001/Bill/0210/0220/0 2002/Chris/0310/0320/0 2003/Devon/0140/0420/0 2004/Eli/0510/0520/1 2005/Fred/0610/0620/2 2006/Gilbert/0710/0820/3 2007/Herbert/0910/0920/4 2008/Kim/1010/1020/5 Thanks a lot If you have any query please feel free and ask