Code Monkey home page Code Monkey logo

vowel-consonant-finder's Introduction

Vowel-consonant-finder

Simple api which takes letter as an input from the console and shows in the output whether it is a vowel or consonant, and it continues until 'exit' keyword is entered.

  • Project is built on gradle building tool, to run the program, enter to the directory where main class is located, the rung the following command './gradlew build'. When building is successful, find executable file *.jar. Then run the following command 'java -jar lib.jar'

Image

  • The program starts by importing the Scanner class from the java.util package, which allows reading user input.
  • In the main method, a Scanner object named input is created to read user input.
  • The program then enters an infinite loop (while (true)) to continuously prompt for user input.
  • Within the loop, it displays a message to enter "exit" at any time to stop the program. It also prompts the user to enter a letter.
  • The entered letter is stored in the letter variable.
  • If the entered letter is equal to exit, the program calls System.exit(1) to terminate.
  • If the length of the entered letter is not equal to 1, it means the user entered more than one character. In that case, it displays a message asking the user to enter only one letter.
  • If the entered letter is a single character, it checks if it is one of the vowels ("a," "e," "i," "u," "o," or "y"). If it matches any of the vowels, it displays a message indicating that the letter is a vowel. Otherwise, it displays a message indicating that the letter is a consonant.
  • After each iteration, it prints a line of dashes to separate the outputs.
  • The program will continue prompting for input until the user enters "exit" to terminate the program.

vowel-consonant-finder's People

Contributors

afa-farkhod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.