SlideShare a Scribd company logo
1 of 2
Download to read offline
JAVA Assistance please! I need help with a Java GUI. I have to put a GUI on top of the word
occurrences class that has some basic interactivity with the user. Try to follow the GUI
guidelines and practices that you learned about, so that the GUI is clean and usable. My code is
below:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
public class Word_SearcherV2 {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new FileReader("src//textfile.txt"));
// creating an empty map used to store word and frequencies of all words
Map wordCounts = new HashMap<>();
String line;
while ((line = bufferedReader.readLine()) != null) {
// splitting line by use regular expression
String[] words = line.split("[s.;,?:!()"]+");
// iterate all words
for (String word : words) {
word = word.trim();
if (word.length() > 0) {
if (wordCounts.containsKey(word)) {
wordCounts.put(word, wordCounts.get(word) + 1);
} else {
wordCounts.put(word, 1);
}
}
}
}
// sorting wordCounts by frequency
Map sortedWordCounts = wordCounts.entrySet().stream()
.sorted(Collections.reverseOrder(Entry.comparingByValue()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1,
LinkedHashMap::new));
// printing word and frequencies of all words
System.out.printf("%-20s%15sn", "Word", "Frequency");
System.out.printf("%-20s%15sn", "====", "=========");
for (Map.Entry entry : sortedWordCounts.entrySet()) {
System.out.printf("%-20s%10sn", entry.getKey(), entry.getValue());
}
bufferedReader.close();
}
}

More Related Content

Similar to JAVA Assistance please! I need help with a Java GUI. I have to put a.pdf

Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to javajalinder123
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDrRajeshreeKhande
 
Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)Jens Ravens
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruNithin Kumar,VVCE, Mysuru
 
Write a java program that compute the frequency of each word in the fi.docx
Write a java program that compute the frequency of each word in the fi.docxWrite a java program that compute the frequency of each word in the fi.docx
Write a java program that compute the frequency of each word in the fi.docxnoreendchesterton753
 
Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)ejlp12
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCFAKHRUN NISHA
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software DevelopmentZeeshan MIrza
 
How to write a simple java program in 10 steps
How to write a simple java program in 10 stepsHow to write a simple java program in 10 steps
How to write a simple java program in 10 stepsIshara Amarasekera
 
Design pattern is_everywhere_by_saurabh_sharma
Design pattern is_everywhere_by_saurabh_sharmaDesign pattern is_everywhere_by_saurabh_sharma
Design pattern is_everywhere_by_saurabh_sharmaSaurabh Sharma
 
Create & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptxCreate & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptxvishal choudhary
 

Similar to JAVA Assistance please! I need help with a Java GUI. I have to put a.pdf (20)

Introduction To Java.
Introduction To Java.Introduction To Java.
Introduction To Java.
 
Intoduction to java
Intoduction to javaIntoduction to java
Intoduction to java
 
Dr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to javaDr. Rajeshree Khande :Intoduction to java
Dr. Rajeshree Khande :Intoduction to java
 
Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
Pimp My Java LavaJUG
Pimp My Java LavaJUGPimp My Java LavaJUG
Pimp My Java LavaJUG
 
Javanotes
JavanotesJavanotes
Javanotes
 
Write a java program that compute the frequency of each word in the fi.docx
Write a java program that compute the frequency of each word in the fi.docxWrite a java program that compute the frequency of each word in the fi.docx
Write a java program that compute the frequency of each word in the fi.docx
 
Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)Introduction to Apache Cordova (Phonegap)
Introduction to Apache Cordova (Phonegap)
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
basic_java.ppt
basic_java.pptbasic_java.ppt
basic_java.ppt
 
Introduction to Software Development
Introduction to Software DevelopmentIntroduction to Software Development
Introduction to Software Development
 
How to write a simple java program in 10 steps
How to write a simple java program in 10 stepsHow to write a simple java program in 10 steps
How to write a simple java program in 10 steps
 
About java
About javaAbout java
About java
 
Design pattern is_everywhere_by_saurabh_sharma
Design pattern is_everywhere_by_saurabh_sharmaDesign pattern is_everywhere_by_saurabh_sharma
Design pattern is_everywhere_by_saurabh_sharma
 
Create & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptxCreate & Execute First Hadoop MapReduce Project in.pptx
Create & Execute First Hadoop MapReduce Project in.pptx
 
java basics.pptx
java basics.pptxjava basics.pptx
java basics.pptx
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Java quickref
Java quickrefJava quickref
Java quickref
 
Java lab-manual
Java lab-manualJava lab-manual
Java lab-manual
 

More from sanjeevbansal1970

In the year 3000, engineers at MIT finally created the technology ne.pdf
In the year 3000, engineers at MIT finally created the technology ne.pdfIn the year 3000, engineers at MIT finally created the technology ne.pdf
In the year 3000, engineers at MIT finally created the technology ne.pdfsanjeevbansal1970
 
In the context of fraud explain the differences between (1) incentiv.pdf
In the context of fraud explain the differences between (1) incentiv.pdfIn the context of fraud explain the differences between (1) incentiv.pdf
In the context of fraud explain the differences between (1) incentiv.pdfsanjeevbansal1970
 
In the article liars dont qualify by Junius Edwards, What does the .pdf
In the article liars dont qualify by Junius Edwards, What does the .pdfIn the article liars dont qualify by Junius Edwards, What does the .pdf
In the article liars dont qualify by Junius Edwards, What does the .pdfsanjeevbansal1970
 
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdf
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdfIn PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdf
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdfsanjeevbansal1970
 
In the early 1970s, the US economy experienced a strong increase in.pdf
In the early 1970s, the US economy experienced a strong increase in.pdfIn the early 1970s, the US economy experienced a strong increase in.pdf
In the early 1970s, the US economy experienced a strong increase in.pdfsanjeevbansal1970
 
In the context of crystallization of monazite in a silicate melt, La.pdf
In the context of crystallization of monazite in a silicate melt, La.pdfIn the context of crystallization of monazite in a silicate melt, La.pdf
In the context of crystallization of monazite in a silicate melt, La.pdfsanjeevbansal1970
 
in the article liars dont qualify, y Junius Edwards, What does the .pdf
in the article liars dont qualify, y Junius Edwards, What does the .pdfin the article liars dont qualify, y Junius Edwards, What does the .pdf
in the article liars dont qualify, y Junius Edwards, What does the .pdfsanjeevbansal1970
 
In which of the following ways can you not use a subquery in a SELEC.pdf
In which of the following ways can you not use a subquery in a SELEC.pdfIn which of the following ways can you not use a subquery in a SELEC.pdf
In which of the following ways can you not use a subquery in a SELEC.pdfsanjeevbansal1970
 
In the Government of Canada, individuals within departments to whom .pdf
In the Government of Canada, individuals within departments to whom .pdfIn the Government of Canada, individuals within departments to whom .pdf
In the Government of Canada, individuals within departments to whom .pdfsanjeevbansal1970
 
In Xcode, Using decomposition, type the code that will most efficien.pdf
In Xcode, Using decomposition, type the code that will most efficien.pdfIn Xcode, Using decomposition, type the code that will most efficien.pdf
In Xcode, Using decomposition, type the code that will most efficien.pdfsanjeevbansal1970
 
In the article liars dont qualify by Junius Edwards, What is the pu.pdf
In the article liars dont qualify by Junius Edwards, What is the pu.pdfIn the article liars dont qualify by Junius Edwards, What is the pu.pdf
In the article liars dont qualify by Junius Edwards, What is the pu.pdfsanjeevbansal1970
 
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdf
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdfJohn y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdf
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdfsanjeevbansal1970
 
John is a minor who lives with his mother and stepfather and not his.pdf
John is a minor who lives with his mother and stepfather and not his.pdfJohn is a minor who lives with his mother and stepfather and not his.pdf
John is a minor who lives with his mother and stepfather and not his.pdfsanjeevbansal1970
 
John and Sara are married and live in AZ. They do not have a prenup.pdf
John and Sara are married and live in AZ.  They do not have a prenup.pdfJohn and Sara are married and live in AZ.  They do not have a prenup.pdf
John and Sara are married and live in AZ. They do not have a prenup.pdfsanjeevbansal1970
 
In Visual Studios C# console app using multiple class files create a.pdf
In Visual Studios C# console app using multiple class files create a.pdfIn Visual Studios C# console app using multiple class files create a.pdf
In Visual Studios C# console app using multiple class files create a.pdfsanjeevbansal1970
 
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdf
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdfJoel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdf
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdfsanjeevbansal1970
 
Jin has configured File History on his Windows 10 computer using an .pdf
Jin has configured File History on his Windows 10 computer using an .pdfJin has configured File History on his Windows 10 computer using an .pdf
Jin has configured File History on his Windows 10 computer using an .pdfsanjeevbansal1970
 
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdf
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdfJJ firm has a return on equity of 15 percent, a return on assets of 10.pdf
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdfsanjeevbansal1970
 
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdf
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdfJim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdf
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdfsanjeevbansal1970
 
Jean has her first child at age 14. By the time she is 30, she has f.pdf
Jean has her first child at age 14. By the time she is 30, she has f.pdfJean has her first child at age 14. By the time she is 30, she has f.pdf
Jean has her first child at age 14. By the time she is 30, she has f.pdfsanjeevbansal1970
 

More from sanjeevbansal1970 (20)

In the year 3000, engineers at MIT finally created the technology ne.pdf
In the year 3000, engineers at MIT finally created the technology ne.pdfIn the year 3000, engineers at MIT finally created the technology ne.pdf
In the year 3000, engineers at MIT finally created the technology ne.pdf
 
In the context of fraud explain the differences between (1) incentiv.pdf
In the context of fraud explain the differences between (1) incentiv.pdfIn the context of fraud explain the differences between (1) incentiv.pdf
In the context of fraud explain the differences between (1) incentiv.pdf
 
In the article liars dont qualify by Junius Edwards, What does the .pdf
In the article liars dont qualify by Junius Edwards, What does the .pdfIn the article liars dont qualify by Junius Edwards, What does the .pdf
In the article liars dont qualify by Junius Edwards, What does the .pdf
 
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdf
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdfIn PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdf
In PYTHON please. I will upvote!Problem 1.8 Case Study Bounc.pdf
 
In the early 1970s, the US economy experienced a strong increase in.pdf
In the early 1970s, the US economy experienced a strong increase in.pdfIn the early 1970s, the US economy experienced a strong increase in.pdf
In the early 1970s, the US economy experienced a strong increase in.pdf
 
In the context of crystallization of monazite in a silicate melt, La.pdf
In the context of crystallization of monazite in a silicate melt, La.pdfIn the context of crystallization of monazite in a silicate melt, La.pdf
In the context of crystallization of monazite in a silicate melt, La.pdf
 
in the article liars dont qualify, y Junius Edwards, What does the .pdf
in the article liars dont qualify, y Junius Edwards, What does the .pdfin the article liars dont qualify, y Junius Edwards, What does the .pdf
in the article liars dont qualify, y Junius Edwards, What does the .pdf
 
In which of the following ways can you not use a subquery in a SELEC.pdf
In which of the following ways can you not use a subquery in a SELEC.pdfIn which of the following ways can you not use a subquery in a SELEC.pdf
In which of the following ways can you not use a subquery in a SELEC.pdf
 
In the Government of Canada, individuals within departments to whom .pdf
In the Government of Canada, individuals within departments to whom .pdfIn the Government of Canada, individuals within departments to whom .pdf
In the Government of Canada, individuals within departments to whom .pdf
 
In Xcode, Using decomposition, type the code that will most efficien.pdf
In Xcode, Using decomposition, type the code that will most efficien.pdfIn Xcode, Using decomposition, type the code that will most efficien.pdf
In Xcode, Using decomposition, type the code that will most efficien.pdf
 
In the article liars dont qualify by Junius Edwards, What is the pu.pdf
In the article liars dont qualify by Junius Edwards, What is the pu.pdfIn the article liars dont qualify by Junius Edwards, What is the pu.pdf
In the article liars dont qualify by Junius Edwards, What is the pu.pdf
 
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdf
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdfJohn y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdf
John y Jim tienen aversi�n al riesgo y solo se preocupan por la medi.pdf
 
John is a minor who lives with his mother and stepfather and not his.pdf
John is a minor who lives with his mother and stepfather and not his.pdfJohn is a minor who lives with his mother and stepfather and not his.pdf
John is a minor who lives with his mother and stepfather and not his.pdf
 
John and Sara are married and live in AZ. They do not have a prenup.pdf
John and Sara are married and live in AZ.  They do not have a prenup.pdfJohn and Sara are married and live in AZ.  They do not have a prenup.pdf
John and Sara are married and live in AZ. They do not have a prenup.pdf
 
In Visual Studios C# console app using multiple class files create a.pdf
In Visual Studios C# console app using multiple class files create a.pdfIn Visual Studios C# console app using multiple class files create a.pdf
In Visual Studios C# console app using multiple class files create a.pdf
 
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdf
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdfJoel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdf
Joel y Maria tienen un hijo llamado David, un estudiante de 20 a�os .pdf
 
Jin has configured File History on his Windows 10 computer using an .pdf
Jin has configured File History on his Windows 10 computer using an .pdfJin has configured File History on his Windows 10 computer using an .pdf
Jin has configured File History on his Windows 10 computer using an .pdf
 
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdf
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdfJJ firm has a return on equity of 15 percent, a return on assets of 10.pdf
JJ firm has a return on equity of 15 percent, a return on assets of 10.pdf
 
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdf
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdfJim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdf
Jim Harrod, hizmetin her eyden �nce m�terileri i�in �nemli olduunu b.pdf
 
Jean has her first child at age 14. By the time she is 30, she has f.pdf
Jean has her first child at age 14. By the time she is 30, she has f.pdfJean has her first child at age 14. By the time she is 30, she has f.pdf
Jean has her first child at age 14. By the time she is 30, she has f.pdf
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
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
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
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
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
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
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

JAVA Assistance please! I need help with a Java GUI. I have to put a.pdf

  • 1. JAVA Assistance please! I need help with a Java GUI. I have to put a GUI on top of the word occurrences class that has some basic interactivity with the user. Try to follow the GUI guidelines and practices that you learned about, so that the GUI is clean and usable. My code is below: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; public class Word_SearcherV2 { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new FileReader("src//textfile.txt")); // creating an empty map used to store word and frequencies of all words Map wordCounts = new HashMap<>(); String line; while ((line = bufferedReader.readLine()) != null) { // splitting line by use regular expression String[] words = line.split("[s.;,?:!()"]+"); // iterate all words for (String word : words) { word = word.trim();
  • 2. if (word.length() > 0) { if (wordCounts.containsKey(word)) { wordCounts.put(word, wordCounts.get(word) + 1); } else { wordCounts.put(word, 1); } } } } // sorting wordCounts by frequency Map sortedWordCounts = wordCounts.entrySet().stream() .sorted(Collections.reverseOrder(Entry.comparingByValue())) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); // printing word and frequencies of all words System.out.printf("%-20s%15sn", "Word", "Frequency"); System.out.printf("%-20s%15sn", "====", "========="); for (Map.Entry entry : sortedWordCounts.entrySet()) { System.out.printf("%-20s%10sn", entry.getKey(), entry.getValue()); } bufferedReader.close(); } }