Tsumaru said:I posted VB, she posted Java... Get your shit right, you ignorant loser. I bet you have no idea how to code in anything.[/b]
is this the java you are talking about?
chpal said:Im sorry sabia ; ; Im just soo bored in AP Java ; ;
//Sentence.java
/**
Reverse a sentence.
*/
public class Sentence
{
/**
Creates a Sentence object.
@param aPhrase a sentence to reverse.
*/
public Sentence(String aPhrase)
{
phrase = aPhrase;
}
/**
Reverses a sentence.
@return the reversed sentence
*/
public String reverse()
{
char c;
String rest;
if (!phrase.equals(""))
{
c= phrase.charAt(0);
rest = phrase.substring(1);
tailSentence = new Sentence(rest);
phrase = tailSentence.reverse() + c;
}
return phrase;
}
/**
Determines if a string exists from the phrase.
@param text the string to find
@return true if the string is found, false otherwise
*/
public boolean find(String text)
{
if (phrase.length() < text.length()) return false;
if (phrase.startsWith(text)) return true;
Sentence shorter= new Sentence(phrase.substring(1));
return shorter.find(text);
}
/**
Gets the sentence.
@return the sentence
*/
public String getText()
{
return phrase;
}
private String phrase;
private Sentence tailSentence;
}
//ExP17_4.java
/**
A test class for Sentence.
*/
import javax.swing.JOptionPane;
public class ExP17_4
{
public static void main(String[] args)
{
String input = JOptionPane.showInputDialog("Enter a Sentence");
String input2 = JOptionPane.showInputDialog("Enter a phrase");
String input3 = JOptionPane.showInputDialog("Enter a Letter");
Sentence s = new Sentence(input);
boolean b = s.find(input2);
System.out.println(b);
b = s.find(input3);
System.out.println(b);
}
}
bc if so the person you called a she is a he, and the same person who posted above you whom you said had no idea how to code anything.