error class or interface expected
class project
// Student Name : Edmond Shiels
// Student Id Number : C00111247
// Date :1/9/2005
// Purpose : A Sample skeleton program
{
public static int countSpaces(String theSent)
{
int index;
int numSpaces = 0 ;
for (index=0; index < theSent.length(); index++)
{
if (theSent.charAt(index) ==' ')
{
numSpaces ++;
}
}
return numSpaces ;
}
public static int countWords(String theSent)
{
int index;
int countWords = 0 ;
for (index=0; index < theSent.length(); index++)
{
if (theSent.charAt(index) ==' ')
{
countWords ++;
}
}
return countWords +1;
}
public static int validWord(String words)
{
String presentWord = "";
String sentence = "";
String word = "";
String newSentence= "";
int WordApp = 1;
int spacePos = 0;
int index =0;
int wordApp=0;
char presentChar = ' ';
boolean isValid = true;
int validWord=0;
while (sentence.indexOf(' ')!= -1)
{
spacePos = sentence.indexOf(" ");
presentWord = sentence.substring(0,spacePos);
sentence = sentence.substring(spacePos+1);
for (index =0; index<presentWord.length(); index++)
{
presentChar = presentWord.charAt(index);
if(! ((presentChar >= 'A')&& (presentChar <= 'Z')||
(presentChar >= 'a')&& (presentChar <= 'z')))
{
isValid = false;
}
}
if(isValid == true)
{
wordApp++;
newSentence = newSentence + presentWord + " ";
}
isValid = true;
}
return validWord ;
}
public static void length(String wordLength)
{
String sentance;
int spacePos;
int numWords ;
int newSentence =0 ;
int wordApp = 0;
int count=0;
String longestWord;
int validWord;
int words=0;
//String word;
int noOfWords;
// String noOfWords;
// System.out.println("Enter a sentance.");
sentance = "The First Fir$t SP Project sp"; // EasyIn.getString();
count = countSpaces(sentance) ;
numWords = countWords(sentance) ;
//validWord = words(sentance,words);
//}
//return isValid;
//}
System.out.println("This sentance has " + count + " spaces");
System.out.println("This sentance has " + numWords) ;
System.out.println( sentance);
System.out.println(newSentence);
//System.out.println("there is " + wordApp + " valid words ");
//System.out.println("valid words " + validWord(sentance));
// spacePos= sentance.indexOf(" ");
// longestWord = sentance.substring(0,spacePos++);
// System.out.println("longest word " + longestWord );
}
}
public static String length(int longestWord,int shorestWord)
{
int start =0;
int finish;
String sentance;
String subSentance;
int longestWordCount = 0;
String longestWord ="";
int shorestWordCount;
String shorestWord;
sentance = "The First Fir$t SP Project sp" ;
System.out.println(sentance);
shorestWordCount = sentance.length();
shorestWord = sentance;
finish = sentance.indexOf(' ');
while (finish != -1)
{subSentance = sentance.substring(start,finish);
start= finish + 1;
finish = sentance.indexOf(' ',start);
if(shorestWordCount > subSentance.length())
{
shorestWord = subSentance;
shorestWordCount = subSentance.length();
}
if(longestWordCount < subSentance.length())
{
longestWord = subSentance;
longestWordCount = subSentance.length();
}
}
return longestWord ;
}
}
return shorestWord ;
}
}
System.out.println("The longest word is " + longestWord);
System.out.println("The shorest word is " + shorestWord);
}
}
this is the question
Java Programming Project 1 (2006-2007)
Sentence Statistics
For this project you are required to write a program which takes a sentence(i.e. string) as input , and prints out various statistics about the sentence. Sample output for the program will be shown below.
Example
Input sentence :
The first fir$t SP Project sp
Sentence Statistics
The Number of Valid Words5
The Longest WordProject
The Shortest WordSP
The Number of Times the longest word appeared (Ignoring Case)1
The Number of Times the shortest word appeared (Ignoring Case)2
The words counted by the program should only be valid words i.e. only those containing alphabetic characters.
NB: The project should be written using static methods. It is to be available for collection on the top level directory on your M drive by Friday Feb 2nd at 4pm and saved as prj10607.java
Note : Projects must be completed on your own, and plagiarism will result in all marks being deducted.
NB A written test based on the concepts required to solve this problem will be given immediately after this project is collected, if you do not submit both components i.e. project code and written tests you will NOT get a mark.
help today if possible
[5439 byte] By [
Edmond1a] at [2007-11-26 16:58:47]

> Note : Projects must be completed on your own, and> plagiarism will result in all marks being deducted.Interesting. Did you mean to post this part. Also use code tags!> help today if possibleYou mean I can't wait till after your assignment is due?
please use code tags in future!you're in brackets hell. either more closing brackets than opening ones, or the other way round. you're also duplicating some local variable names, as you'll find when you fix the bracket problem
> please use code tags in future!
>
> you're in brackets hell. either more closing brackets
> than opening ones, or the other way round. you're
> also duplicating some local variable names, as you'll
> find when you fix the bracket problem
> please use code tags in future!
>
> you're in brackets hell. either more closing brackets
> than opening ones, or the other way round. you're
> also duplicating some local variable names, as you'll
> find when you fix the bracket problem
fix the problems for me
> > please use code tags in future!
> >
> > you're in brackets hell. either more closing
> brackets
> > than opening ones, or the other way round. you're
> > also duplicating some local variable names, as
> you'll
> > find when you fix the bracket problem
>
> > please use code tags in future!
> >
> > you're in brackets hell. either more closing
> brackets
> > than opening ones, or the other way round. you're
> > also duplicating some local variable names, as
> you'll
> > find when you fix the bracket problem
>
> fix the problems for me
fuck off and do your own homework you lazy sod
> fix the problems for meAre you that lazy?What about this part:> Note : Projects must be completed on your own, and> plagiarism will result in all marks being deducted.
if you're going to cheat at homework, it's probably best to do it anonymously. not give out your student ID and the domain name of the Carlow Institute of Technology whom I have just emailed
> fix the problems for me
Please specify the level of assistance you require and/or expect from us:
A) want to understand and learn, and in the near future be able to solve things yourself, independently
B) want a skeleton solution where you only need to fill in a couple of blanks
C) want a complete solution
D) want a complete solution + anti-plagiarism-detection-obfuscation so your prof won't be able to find out
In addition to choosing an option, please supply your professor's e-mail contact address so our scripts can detect and warn you if he is checking these forums.
Lokoa at 2007-7-8 23:26:35 >

> > fix the problems for me
>
> Please specify the level of assistance you require
> and/or expect from us:
> A) want to understand and learn, and in the near
> future be able to solve things yourself,
> independently
> B) want a skeleton solution where you only need to
> fill in a couple of blanks
> C) want a complete solution
> D) want a complete solution +
> anti-plagiarism-detection-obfuscation so your prof
> won't be able to find out
>
> In addition to chosing an option, please supply your
> professor's e-mail contact address so our scripts can
> detect and warn you if he is checking these forums.
The Carlow Institute of Technology, in Ireland, were kind enough to include a complete contact directory on their website
Edmond,Maybe you should just stick to Bridge?
> The Carlow Institute of Technology, in Ireland, were
> kind enough to include a complete contact directory
> on their website
Sure, but doesn't that take, like, really a lot of effort and, whatchacallit, the research thingy, to find out who exactly their prof is? Isn't it easier* if they supply the information we need to truly help them themselves?
* Not to mention, more ironic.
Lokoa at 2007-7-8 23:26:35 >

I hereby, reluctantly and for the umpteenth time, accept Sun's apologies for hosting these fora in such an unreliable manner as to cause me to accidentally double-post.Message was edited by: Loko
Lokoa at 2007-7-8 23:26:35 >

> > The Carlow Institute of Technology, in Ireland,
> were
> > kind enough to include a complete contact
> directory
> > on their website
>
> Sure, but doesn't that take, like, really a lot of
> effort and, whatchacallit, the research thingy, to
> find out who exactly their prof is? Isn't it easier*
> if they supply the information we need to truly help
> them themselves?
>
> * Not to mention, more ironic.
depends on whether you really want to report them to, say, one of the Registrars, or just want to scare them a bit
I was going to post a solution for poor edmond, but then I realized that my solution was so far over his head, the professor would know in an instant that there was no way he did it himself. I don't want poor Edmond to be embarassed in front of his class, so I will not post my solution. Especially since george has so kindly brought the prof's attention to this forum, and would therefore remove all doubt as to the source of the solution.
~Tim
> fix the problems for me
I believe what you meant to say was, "Could somebody explain to me what that error message means and how I can use it to fix my own problem, so that next time this happens, I'll be able to fix it myself? Oh, and sorry for the code being all unreadable, unindented, proportional-width font; I'm unaware of the code button or [code] and [/code] tags."
> > fix the problems for me
>
> I believe what you meant to say was, "Could somebody
> explain to me what that error message means and how I
> can use it to fix my own problem, so that next time
> this happens, I'll be able to fix it myself? Oh, and
> sorry for the code being all unreadable, unindented,
> proportional-width font; I'm unaware of the
> code button or [code] and [/code]
> tags."
no, he definately meant "fix the problems for me". I did. I emailed his college
did you google his name to figure out his college?
> did you google his name to figure out his college?The OP listed his email address in his profile. Checking that domain is easy.
What did you email to the college? "Your student is an idiot"?
> What did you email to the college? "Your student is> an idiot"?heh heh no, something a bit more substantial than that. along the lines of this student is demanding that people do his assignment for him
That's evil. I like it. The best lessons are learned the hard way, right?
> That's evil. I like it. The best lessons are learned
> the hard way, right?
if he hadn't said "fix the problems for me" when I told them roughly what they were, and to fix them, I wouldn't have bothered. I had some assignments stolen by other students at uni, I'm not really sympathetic to the lazy sh!t "I'll get the answers on the internet" mob
After people suggested to him to use code tags and check the brackets, etc., and he replied with "fix the problems for me", I actually laughed out loud. Good call.