You are on page 1of 19

GOVERNMENT POLYTECHNIC ACHALPUR

2023-2024

A PROJECT REPORT ON

“WORD COUNTER”
SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE
AWARD
OF

DIPLOMA IN
DEPARTMENT OF COMPUTER ENGINEERING

SUBMITTED TO

MAHARASHTRA STATE BOARD OF TECHNICALEDUCATION ,MUMBAI. SUBMITTED BY

Name of Students Enrolment No.


RUTU MORE 2218570204

ABHISHEK LIMBALKAR 2018570146

YOGESH PATIL 2118570116

PRATHMESH RAJEBHOSLE 2218570192

ARPIT DAHRPAWAR 2118570106


CERTIFICATE

This is to certify that the report submitted by Roll No


a student of fifth Semester Diploma Course in COMPUTER ENGINEERING as a
part of Micro Project work as prescribed by the (M.S. Board of Technical
Education, Mumbai) for the subject “Advance Computer Networking” under
which micro project “WORD COUNTER”. is completed and that I have guided him
for the said work from time to time during academic year 2023-2024 and I found
him to be satisfactorily progress and the following student shad associated him
for this work ,how ever his contribution was proportionate.

RUTU MORE PRATHMESH RAJEBHOSLE

ABHISHEK LIMBALKAR ARPIT DHARPAWAR

YOUGESH PATIL

The said work has been assessed by meand I satisfied with same is up to
the standard envisaged for the course. The said work may be presented to
the external examiner.

:GUIDEDBY:

PROF. S. H. BAILMARE PROF.A.G.RAUT


Lecturer of Computer Dept. Principal,
Government Polytechnic, Government Polytechnic,
Achalpur. Achalpur.
SUBMISSION

I_ _RollNo Student of Fifth


Semester Diploma Course COMPUTERENGINEERING humbly

Submit that I have completed this micro project by my own skill and study
between the period from 2023-2024 as per the Instruction guidance of PROF. S.
H. BAILMARE

RUTU MORE PRATHMESH RAJEBHOSLE

ABHISHEK LIMBALKAR ARPIT DHARPAWAR

YOGESH PATIL

I have not copied the report or it’s any appreciable part from any

other Literature connection with academic ethics.

Signature of Student Signature of Lecturer


PROF S. H. BAILMARE
ACKNOWLEDGEMENT

This project is done as a semester micro project ,as a part course titled WORD
COUNTER. We are thankful to our Principal Prof .A.G.RAUT and the HOD Prof. S.H.
BAILMARE, Computer Engineering Department, Government Polytechnic,
Achalpur, for his invaluable guidance and assistance, without which the
accomplishment of the task would have never been possible. We thank Prof.
S.H. BAILMARE giving this opportunity to explore into the real world and realize
the inter relation without which a project can never progress. In our present
project we have chosen the topic “WORD COUNTER”. We are also thankful to our
friends and all our staff of Computer Engineering Department, for providing us
relevant information and necessary clarifications, and great support
INDEX

Sr. No. Title Page No.

1. INTRODUCTION 1.

2. REQUIREMENTS 2.

3. SOURCE CODE 3.

4. OUTPUT 6

ADVANTAGES AND
5. 8
DISADVANTAGES

6. FEATURES 9

7. CONCLUSION 10

REFERENCES
WORD COUNTER

INTRODUCTION

In the realm of computer programming, a "word counter" in Java refers to a software


application or function designed to count the number of words within a given text or
document. This tool is particularly useful in various applications, such as text analysis,
content management, and data processing, where knowing the word count is essential for
various purposes, including document length analysis, readability assessments, or
enforcing word limits.
In Java, developers can create a word counter by implementing a program that parses a
text input and separates it into individual words, often by splitting the text using
whitespace or other delimiters. The program then counts the number of resulting words
and provides this count as output. This functionality is commonly employed in text
editors, word processors, and websites where users need to keep track of word counts in
their written content, such as essays, articles, or blog posts.
A Java word counter can be a valuable tool for writers, editors, and content creators, as it
simplifies the process of tracking the length and complexity of their texts.

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

SYSTEM REQUIREMENTS

The minimum requirement for the following code to run is as follows:


 Ram: 2 GB
 Processor: intel i3 and above, amd ryzen 3 and above
 HDD: 256 GB
 Software Used: Visual Studio Code
 Graphic Card:Integrated Graphics

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

SOURCE CODE
import javax.swing.*;
import java.awt.event.*;
import java.awt.Font;

class Main {
public static void main(String args[]) {
JFrame f = new JFrame("Character Count");
JLabel l2, l3, l4;
JTextArea
text;
JLabel l1;
JButton submit, clear;
text = new
JTextArea("");
submit = new JButton("SUBMIT");
clear = new JButton("CLEAR");
l1 = new JLabel("Enter Your string Here : ");
l2 = new JLabel("Character with Spaces : ");
l3 = new JLabel("Character Without Spaces : ");
l4 = new JLabel("Words : ");
Font txtFont = new Font(Font.SERIF, Font.PLAIN, 16);
l1.setFont(txtFont);
l2.setFont(txtFont);
l3.setFont(txtFont);
l4.setFont(txtFont);
l1.setBounds(10, 25, 200, 30);
text.setBounds(18, 60, 450, 300);
l2.setBounds(10, 370, 400, 30);
l3.setBounds(10, 400, 400, 30);

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

l4.setBounds(10, 430, 400, 30);

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

submit.setBounds(100, 470, 100, 50);


clear.setBounds(275, 470, 100, 50);
text.setLineWrap(true);
text.setWrapStyleWord(true);
submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String str = text.getText().strip();
int count = 0, i, word = 0;
l2.setText("Character with Spaces : " +
str.length()); for (i = 0; i < str.length(); i++) {
if (str.charAt(i) != '
') count++;
else
word++;
}
l3.setText("Character Without Spaces : " + count);
14.setText("Words : " + (word + 1));
}
});
clear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
text.setText("");
l2.setText("Character with Spaces : ");
l3.setText("Character Without Spaces :
"); l4.setText("Words : ");
});
f.add(l1);
f.add(text);
f.add(l2);

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

f.add(l3);
f.add(l4);
f.add(submit);
f.add(clear);
f.setSize(500, 570);
f.setResizable(false);
f.setLayout(null);
f.setLocationRelativeTo(null);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

OUTPUT

Figure 1

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

Figure 2

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

ADVANTAGES

Efficiency: Word counters in Java can efficiently process large text documents and count
words within them. Java's performance and memory management capabilities make it
well- suited for handling substantial amounts of text.
Accuracy: Java word counters can provide accurate word counts, as Java's string
manipulation and regular expression capabilities enable precise parsing of text. This is
important in applications where word count accuracy is crucial, such as academic writing
or legal documents.
Automation: Word counters in Java can be integrated into automated content
management systems and text analysis tools, allowing for streamlined and consistent
word counting in various applications, from websites to publishing platforms.
Customization: Java allows developers to create highly customizable word counters.
You can tailor the counting algorithm to account for specific needs, such as excluding or
including certain characters, handling different languages, or applying custom rules for
counting.

DISADVANTAGES

Development Time: Developing a word counter in Java, especially a highly customizable


and feature-rich one, can be time-consuming. This may not be practical if you need a quick
and simple solution.

Resource Intensive: Java applications can be more resource-intensive in terms of memory


and processing power compared to some other programming languages. This could be a
concern when dealing with very large documents.

Learning Curve: If you're not familiar with Java, there may be a learning curve to develop a
word counter in the language. This could be a disadvantage if you need a word counter
quickly and don't have experience with Java.

GOVERNMENT POLYTECHNIC Page


WORD COUNTER

FEATURES

Word Counting: The primary feature is, of course, the ability to accurately count the
number of words in a given text or document. This includes handling different languages,
character encodings, and counting words based on user-defined rules.
Character Count: In addition to word count, the word counter can provide a character
count, which is useful in scenarios where character limits are important, such as in social
media posts or SMS messages.
Line Count: The ability to count the number of lines in a document can be useful for
assessing document structure and readability.

Sentence Count: Some word counters can go a step further by counting sentences, which
can be helpful for assessing the complexity of a text.

Paragraph Count: Counting paragraphs can provide insights into the document's
structure and organization

GOVERNMENT POLYTECHNIC Page


WORD

CONCLUSION

In short, a word counter in Java is a valuable tool for accurately counting words and
offering additional text analysis features. It aids writers and professionals in various
fields, but the choice to use it should consider factors like development time and resource
usage. It streamlines content management, helps meet word limits, and enhances
readability.

GOVERNMENT POLYTECHNIC Page


REFERENCES

 https://www.tutorialspoint.com/awt/index.htm

 https://www.javatpoint.com/

 www.chatgpt.com

 www.bard.com

You might also like