jeudi 29 janvier 2015

How do I check to see if a word contains a letter or group of letters?

I am working on a program for my CompSci I class and I'm entirely stuck. The assignment is to use if statements to check whether a particular string contains a letter or group of letters. I have a class created for this and I've laid out everything, but I just don't know how to begin searching for the characters. I'm really new to Strings and Return methods. I looked for similar questions already, but none really helped with what I was looking for. I would appreciate some help.


My code so far: Main:



import static java.lang.System.*;

public class Lab04e
{
public static void main(String[] args)
{

}
}


StringChecker:



import static java.lang.System.*;
public class StringChecker {

private String check;

public void StringChecker()
{
check = "";
}

public void StringChecker(String s) //constructor
{
check = s;
}

public void setString(String s) //set string
{
check = s;
}

public boolean letterExists(char a)
{
return false;
}

public boolean findSubString(String s)
{
return false;
}

public String toString()
{
return check +"\n\n";
}
}

Aucun commentaire:

Enregistrer un commentaire