Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tanvir10029 committed May 13, 2021
1 parent a66f668 commit c210011
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions Expedia/hashTableData.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kiosk#001,0,0,0.00
52 changes: 52 additions & 0 deletions Expedia/src/application/expediaServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ public class expediaServer extends Application
public static TextArea textArea_4 = new TextArea();
public static TextArea ta = new TextArea();
TextArea clock;
public static int[] startTrack = {0,0,0,0,0,0,0,0};

static int countOccurences(String str, String word)
{
// split the string by spaces in a
String a[] = str.split(" ");

// search for pattern in a
int count = 0;
for (int i = 0; i < a.length; i++)
{
// if match found increase count
if (word.equals(a[i]))
count++;
}

return count;
}

@Override
public void start (Stage stage) throws FileNotFoundException
Expand Down Expand Up @@ -279,6 +297,40 @@ public void run()
alert.setHeaderText("Client Data");
alert.setResizable(true);

String logString = "";

try
{
File f = new File("transactionLog.txt");
if (f.exists())
{
FileReader reader = new FileReader("transactionLog.txt");
BufferedReader br = new BufferedReader(reader);

String line = br.readLine();
while (line != null)
{
logString = logString + line + "\r\n";
line = br.readLine();
}

br.close();
}
else
{
logString = "No log File Found!";
}
}
catch(Exception e2)
{
e2.printStackTrace();
}

startTrack[0] = countOccurences(logString, "Miami");
startTrack[1] = countOccurences(logString, "New York City");
System.out.println(startTrack[0]);
System.out.println(startTrack[1]);

alert.setContentText("Average Money Spent By Customers: $267.80\nMost Popular City: New York City\nMost Popular Flight Time: 1:00 P.M.\n");

alert.showAndWait();
Expand Down

0 comments on commit c210011

Please sign in to comment.