|
-
April 1st, 2005, 01:32 PM
#1
Help Required
I need someone to write the code for the following program:

I've created the interface but the code is what i cant do. Any help would be much appreciated.
-
April 1st, 2005, 04:22 PM
#2
Re: Help Required
First, you did not actually explain what the problem is. Do you need a program that parses a string to check how many words of a certain length are there?
How much will you pay?
Code:
using System;
using System.Text.RegularExpressions;
using System.Text;
using System.Collections;
namespace ParserNamespace
{
class Class1
{
public int[] ParseString(String text)
{
int [] vector = new int[6];
Regex reg = new Regex(" |, | ,|,");
StringBuilder sbuilder = new StringBuilder();
foreach(string s in reg.Split(text))
{
if(s.Length<6) vector[s.Length-1]++;
else vector[vector.Length-1]++;
}
return vector;
}
[STAThread]
static void Main(string[] args)
{
Class1 test = new Class1();
int [] results = test.ParseString("this is just a simple text,nothing more, nothing less");
int i=1;
foreach(int val in results)
{
Console.WriteLine("Words of length {0} : {1}",i++,val);
}
}
}
}
-
April 1st, 2005, 04:31 PM
#3
-
April 1st, 2005, 04:37 PM
#4
Re: Help Required
The program should calculate and display the number of words that contain 1, 2, 3, 4 or 5 characters as shown in the example. Any words that contain 6 or more characters should be counted together.
If the user does not enter a string before pressing the button, an error message should be displayed and the user asked to enter another string.
The program should be able to handle situations where there is more than one space between the words in the sentence. Punctuation characters such as comma, full-stop, etc can be treated as characters in words.
-
April 1st, 2005, 05:12 PM
#5
Re: Help Required
Are you familiar to C# or not? What I've written basically does want you need, except that is a console application. I'm sorry, but I'm not going to write the entire application for you.
-
April 4th, 2005, 01:57 AM
#6
Re: Help Required
Rob316, you can offer someone to write code for you in JOBS Forum.
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
-
April 6th, 2005, 05:32 AM
#7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|