Skip to content

jenniemeka/wordCounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Counter

Overview

The Word Counter is a simple Java program that counts the number of words in a given sentence. It utilizes the JOptionPane class for user input and graphical display.

WHY THIS PROJECT

  1. Conceptual Simplicity:

The project involves fundamental programming concepts such as input/output, string manipulation, and basic logic, making it accessible for beginners.

  1. Real-World Applicability:

Word counting is a common and practical task, and by building a Word Counter, beginners can see the immediate real-world applicability of their coding skills.

  1. I learnt how to use the split method to make sure it counts the words not character.

Features

  • Takes user input for a sentence.
  • Splits the input into an array of words using the regular expression "\s+".
  • Counts the number of words in the sentence.
  • Displays the result using JOptionPane.

Getting Started

To use the Word Counter program, follow these steps:

  1. Clone this repository to your local machine.
  2. Compile the Java program: javac WordCounter.java
  3. Run the program: java WordCounter

Prerequisites

  • Java Development Kit (JDK) installed on your machine.
  • An Integrated Development Environment (IDE) like IntelliJ IDEA or Eclipse (optional).

How to Run

  1. Clone the repository:

    git clone https://github.com/jennyemeka/word-counter.git
    
  2. Open the project in your preferred IDE or compile and run using the command line.

  3. Run the WordCounter class.

  4. Enter a sentence when prompted.

  5. The program will display the number of words in the sentence using JOptionPane.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details.

CONTACT

For questions, feedback, or collaboration opportunities, please contact me at jenniferemeka24@gmail.com.

Your feedback and contributions are highly appreciated!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages