• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Stuck on Pangram, Please help

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My goal is to create a program that checks a sentence whether or not a pangram




My logic says that i need to compare each letter from each word of Pangram with each index position of Alphabet, if i were to compare two characters array with each letters separately i would have done that with nesting for loop but here its a string so i need to convert the string to characters first.

And for that i know i have the charAt(index position) method.

This is all i know but this knowledge is not enough in order to accomplish the goal and i just don't know how to put together these things and achieve the goal

This is just a basic program which doesn't even require the input from user
 
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"Pangram" variable should start with a lower case letter (as should all variables and methods).
 
Saloon Keeper
Posts: 3416
149
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose you have an array[26], with array[0] containing the frequency of the character 'a' in your possible Pangram sentence, and array[1] cotains the frequency of the character 'b', et cetera. Now, given that sentence, how would you fill that array, and when is that sentence a Pangram?
 
Greenhorn
Posts: 14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When ever I need to know how to do something with a given class, I can usually find it by googling "java <className> <java version number>". The number at the end seems to help me bring up the online JavaDocs instead of a tutorial, which is harder to use as a reference material.

I think taking a look at The String JavaDoc will help you. There are multiple methods there that will help you check a String's characters.

By the way, In Java there are usually lots of different ways to convert one type to another. A String is just an array of numbers (in Java, these are byte primitive-types), each of which represents a letter, number, or other symbol.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!