No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
22 Posted Topics
Your goal is to define a datatype Shape that can answer the question "Get Area?". You need to define the method getArea in each of the subclasses and declare the abstract method in the base class Shape. By declaring the abstract method in Shape, you're saying to the rest of …
Why are you passing the DateTimes by reference to DaysAliveCalculation? I can't see any reason for this. Also, DaysAliveCalculation would be much more reusable if it returned an int. By returning a string, you're suggesting that the function is returning something sneaky.
Thanks for making this posting. In mytan and mycot, not all paths return a value. What do you expect the function's behavior to be then? I would return NaN. Also those functions unnecessarily recalculate mycos and mysin once. Your lines [code] if(y<0) z = myfabs(y); else z = y;[/code] are …
C# delegates make it really easy to implement the visitor pattern. Instead of making an abstract class and Visit methods that accept a single argument of that class's type, let your Visit methods accept multiple arguments. So instead of a visitor class with N abstract methods, your Visit methods take …
You could implement recursive algorithms in ways that avoid risking stack overflow, i.e. by manually implementing a stack of variables or a stack of states. It is better to implement combinators that take pieces of recursive definitions and do this work for you. It is particularly easy to do in …
There's no need to write [icode](int)(Math.random()*100)%3[/icode]. Just write [icode](int)(Math.random() * 3)[/icode].
It is much better to use using blocks for your Bitmap and Graphics objects. [code] using (Bitmap bmap = new Bitmap(ImageBounds.Width, ImageBounds.Height)) using (Graphics G = Graphics.FromImage(bmap)) { G.CopyFromScreen(_TopLeftPt, Point.Empty, ImageBounds.Size); bmap.Save(Fname, ImageFormat.Bmp); }[/code] That way, if an exception occurs, the objects will be properly disposed of.
Popular to implement... But unpopular to use :P
I like the part where you shift by 0 for consistency.
I have not experienced what you described, but I have several friends who had some sort of problem or another of that kind. I had one who was really struggling, when he asked me about some problem he was trying to solve. I asked him why he didn't just figure …
Have you tried regular expressions?
I'm not sure what your problem is. You described the algorithm you want. What is stopping you from implementing it?
If you're that worried about StringBuilder reallocating its buffer, just use something to build your strings that doesn't require any reallocation at all.
Your function is creating a polynomial and modifying that. It is not modifying the object on which it was called. Your latter example, [icode]polynomial p = polynomials[j];[/icode], actually calls the copy constructor to initialize p. The other plausible alternative would for a zero-argument constructor to be called to initialize p, …
[quote]Also, it works if I don't use the ||.[/quote] What does this mean?
[QUOTE=stephen84s;797998]Now I would like you to also go through the [URL="http://java.sun.com/docs/codeconv/"]Sun Coding Conventions[/URL] for Java so that you can name your classes and methods appropriately.[/QUOTE] You should skip this. You already have enough to worry about, and spending mental energy worrying about 11 chapters of arbitrary rules at this stage …
[QUOTE=Diamonddrake;798465] <rant> it can't be stressed enough people. I think it should be a rule. Google before thread! I say all forums should set up to check for a google cookie, if it isn't there, then the submit button on the new thread page automatically opens a new browser window …
You have two problems. First, the first character of a string is a char, not a string, so your variable first_letter should be of type char, not string. Your code is not compiling because the string type's indexer returns a char. Second, your code won't work at runtime, and I'll …
[QUOTE=seanl1;797902]I suppose it's a right of passage to earn the degree.[/QUOTE] You mean a rite of passage. Also, it's the most important or second-most important class you'll take. What version of C# are you familiar with? If you answer in the next few minutes, I'll tailor my answer to [icode]Math.Max(2.0, …
You can't just put variables and strings next to one another. You need to concatenate them with the + operator: [icode]newValue + " + " + i[/icode]
The End.
subtercosm