SlideShare a Scribd company logo
1 of 2
Download to read offline
In Java add GUI to request the list of top 20
import java.io.*;
import java.util.*;
import java.util.List;
import org.jsoup.*; //allows manipulation of HTML
import org.jsoup.nodes.*;
public class Main2 {
public static void main(String[] args) throws IOException {
Document page = Jsoup.connect("https://www.gutenberg.org/files/1065/1065-h/1065-
h.htm").get();
Element div = page.select("div.chapter").first(); //specify location of web page to extract
data
String divText = div.text();
Scanner sc = new Scanner(divText); //obtain input
Map map = new HashMap(); //map keys to value and create table
while (sc.hasNext()){ //loop
String word = sc.next();
word = word.replaceAll(",", ""); // eliminate commas
if(map.containsKey(word) == false) {
map.put(word, 1); //associate value and key for first time word
}
else {
int count = (int)(map.get(word));
map.remove(word);
map.put(word,count + 1); // eliminate repeated word and increase count of repeated
words
}
}
// Collections.sort method to sort list
Set> set = map.entrySet();
List> al = new ArrayList>(set);
Collections.sort(al, new Comparator>() {
public int compare(Map.Entry num, Map.Entry words) {
return (words.getValue()).compareTo(num.getValue());
}
});
System.out.printf("%-15s %-15s%n","Word", "Count"); //decorative header filler for
structure
System.out.printf("%-15s %-15s%n","=========", "=========");
int count = 0;
for(Map.Entry i:al) {
System.out.printf("%-15s %-15s%n", i.getKey(), i.getValue());// print key and value
count++;
if(count == 20) break; // limit output to top 20
}
sc.close(); //close scanner
}}

More Related Content

Similar to In Java add GUI to request the list of top 20import java.io.; i.pdf

Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasaLaporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasaDeprilana Ego Prakasa
 
solution in c++program Program to implement a queue using two .pdf
solution in c++program Program to implement a queue using two .pdfsolution in c++program Program to implement a queue using two .pdf
solution in c++program Program to implement a queue using two .pdfbrijmote
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryAlexandre Morgaut
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talkshonjo2
 
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 Winter
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 WinterHuahin Framework for Hadoop, Hadoop Conference Japan 2013 Winter
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 WinterRyu Kobayashi
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]Nilhcem
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Implement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdfImplement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdfamrishinda
 
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
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Hidenori Fujimura
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfarjuncorner565
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdfganisyedtrd
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax BasicsRichard Paul
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
 
Node js mongodriver
Node js mongodriverNode js mongodriver
Node js mongodriverchristkv
 

Similar to In Java add GUI to request the list of top 20import java.io.; i.pdf (20)

Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasaLaporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
 
solution in c++program Program to implement a queue using two .pdf
solution in c++program Program to implement a queue using two .pdfsolution in c++program Program to implement a queue using two .pdf
solution in c++program Program to implement a queue using two .pdf
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talks
 
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 Winter
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 WinterHuahin Framework for Hadoop, Hadoop Conference Japan 2013 Winter
Huahin Framework for Hadoop, Hadoop Conference Japan 2013 Winter
 
Supstat nyc subway
Supstat nyc subwaySupstat nyc subway
Supstat nyc subway
 
Kill the DBA
Kill the DBAKill the DBA
Kill the DBA
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Implement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdfImplement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.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
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性Web+GISという視点から見たGISの方向性
Web+GISという視点から見たGISの方向性
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
Javascript & Ajax Basics
Javascript & Ajax BasicsJavascript & Ajax Basics
Javascript & Ajax Basics
 
This is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdfThis is Java,I am currently stumped on how to add a scoreboard for.pdf
This is Java,I am currently stumped on how to add a scoreboard for.pdf
 
Node js mongodriver
Node js mongodriverNode js mongodriver
Node js mongodriver
 

More from manojmozy

IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdfIDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdfmanojmozy
 
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdfIf we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdfmanojmozy
 
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdfIdentifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdfmanojmozy
 
If X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdfIf X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdfmanojmozy
 
Identifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdfIdentifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdfmanojmozy
 
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdfidentifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdfmanojmozy
 
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdfIf CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdfmanojmozy
 
Identify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdfIdentify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdfmanojmozy
 
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdfIf a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdfmanojmozy
 
i. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdfi. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdfmanojmozy
 
identify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdfidentify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdfmanojmozy
 
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdfIBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdfmanojmozy
 
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdfi. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdfmanojmozy
 
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdfIDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdfmanojmozy
 
Identify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdfIdentify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdfmanojmozy
 
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdfI. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdfmanojmozy
 
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdfIf the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdfmanojmozy
 
If an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdfIf an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdfmanojmozy
 
Identify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdfIdentify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdfmanojmozy
 
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdfIdentify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdfmanojmozy
 

More from manojmozy (20)

IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdfIDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
 
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdfIf we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
 
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdfIdentifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
 
If X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdfIf X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdf
 
Identifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdfIdentifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdf
 
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdfidentifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
 
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdfIf CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
 
Identify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdfIdentify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdf
 
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdfIf a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
 
i. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdfi. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdf
 
identify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdfidentify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdf
 
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdfIBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
 
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdfi. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
 
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdfIDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
 
Identify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdfIdentify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdf
 
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdfI. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
 
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdfIf the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
 
If an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdfIf an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdf
 
Identify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdfIdentify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdf
 
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdfIdentify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdf
 

Recently uploaded

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
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
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
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
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
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 ...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
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
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
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
 

In Java add GUI to request the list of top 20import java.io.; i.pdf

  • 1. In Java add GUI to request the list of top 20 import java.io.*; import java.util.*; import java.util.List; import org.jsoup.*; //allows manipulation of HTML import org.jsoup.nodes.*; public class Main2 { public static void main(String[] args) throws IOException { Document page = Jsoup.connect("https://www.gutenberg.org/files/1065/1065-h/1065- h.htm").get(); Element div = page.select("div.chapter").first(); //specify location of web page to extract data String divText = div.text(); Scanner sc = new Scanner(divText); //obtain input Map map = new HashMap(); //map keys to value and create table while (sc.hasNext()){ //loop String word = sc.next(); word = word.replaceAll(",", ""); // eliminate commas if(map.containsKey(word) == false) { map.put(word, 1); //associate value and key for first time word } else { int count = (int)(map.get(word)); map.remove(word); map.put(word,count + 1); // eliminate repeated word and increase count of repeated words } } // Collections.sort method to sort list Set> set = map.entrySet(); List> al = new ArrayList>(set); Collections.sort(al, new Comparator>() {
  • 2. public int compare(Map.Entry num, Map.Entry words) { return (words.getValue()).compareTo(num.getValue()); } }); System.out.printf("%-15s %-15s%n","Word", "Count"); //decorative header filler for structure System.out.printf("%-15s %-15s%n","=========", "========="); int count = 0; for(Map.Entry i:al) { System.out.printf("%-15s %-15s%n", i.getKey(), i.getValue());// print key and value count++; if(count == 20) break; // limit output to top 20 } sc.close(); //close scanner }}