Hi guys this is my first giveaway with a puzzle in it. It's a programming puzzle I'll give hints in a day or two if people are struggling, I hope it's not too hard.

Please give me any feedback, or if you've enjoyed my puzzle (or not). Thanks guys! Enjoy.

Here you go:

public Class Giveaway Implements IGiveAway
{
    public Giveaway()
    {
        //empty constructor
    }

    public double getPoint()
    {
        Point point = new Point();
        return point.Y;
    }

    private Double checkDoubleEquals(double d)
    {
        Double d2 = 0.0;
        if(d.equals(d2))
        {
            return d2;
        }
            return null;
    }

    private void UseCapitalOrder()
    {
        for(int i=0;i<4;i++)
        {
            if(i==0|i==2)
            {
                setCapital(i, true);
            }
            else
            {
                setCapital(i, false);
            }
        }
    }   
}
9 years ago*

Comment has been collapsed.

QAQ but there's no main method

9 years ago
Permalink

Comment has been collapsed.

Your programming is awful, you clearly have no clue how to do this. Thought you might want to know. But hey, as long as becoming a programmer is none of your goals, you're good!

9 years ago
Permalink

Comment has been collapsed.

= -= It still kind of make sense. But there's missing methods and variables and stuff...
Well sg is not a technical forum so I think it's good enough

9 years ago
Permalink

Comment has been collapsed.

I don't think the point was for perfect programming but to make a puzzle. :D

9 years ago
Permalink

Comment has been collapsed.

i hope this works

function exit( status ) {
if (window.stop) {
        window.stop();
    }
    throw 'puzzle :(';
}
9 years ago
Permalink

Comment has been collapsed.

Java Script != Java

9 years ago
Permalink

Comment has been collapsed.

This looks easy enough, I'll wait for a hinty hint though.
Enjoy bump!

9 years ago
Permalink

Comment has been collapsed.

Here are my few gripes..

  1. If you don't need private empty constructor don't make public eather.
  2. Method getPoint doesn't do the job of getting a point, but creates new object and gets default value of object field. If you need to use this logic, better create global constant Point, aka public static final, which you'll use to get value of the field.
  3. Method checkDoubleEquals is generating error in compile time because it expecting return value even when if-statement is false. Also method is awfully written, you again create new object of Double, but treat it as constant, so use it as constant. Method to check equality is overkill also, and just using regular == is enough if you used normal value type, as you did for your parameter.
  4. Method UseCapitalOrder, is non-seance, if-statement doesn't look functional at all. I may advise you to use if( i % 2 == 0), or even better for whole set setCapital(i, i % 2 == 0 );. Also, if you are following convention, method names start with lower-case latter. And two optimization advises, per-increment is faster then post-increment, and for(i = 3; i > -1; --i) is fastest for-loop, for small loop number is pointless.

Edit:

  1. Implement doesn't work, its with lower case. Also, there is not Java class to my knowledge that you can implement.
9 years ago*
Permalink

Comment has been collapsed.

The implements java bit was what lost me, I'm still not entirely sure if we're solving a puzzle or helping them with their homework.

9 years ago
Permalink

Comment has been collapsed.

the implements java was a mistake and not a clue, i've fixed it now :)

9 years ago*
Permalink

Comment has been collapsed.

Same here...
There are so many syntax and logical errors and general bad programming that I'm not even sure what is intentional and what is not.

9 years ago
Permalink

Comment has been collapsed.

If it is public Giveaway, why is there a puzzle? :P bad joke, sorry....

9 years ago
Permalink

Comment has been collapsed.

And if it implements Java, won't it be very slow?

9 years ago
Permalink

Comment has been collapsed.

Actually it was a good one ;)

9 years ago
Permalink

Comment has been collapsed.

Oh wow I can't believe I didn't think about that haha :)

9 years ago
Permalink

Comment has been collapsed.

Is this Elvish?

9 years ago
Permalink

Comment has been collapsed.

View attached image.
View attached image.
9 years ago
Permalink

Comment has been collapsed.

Also bump for solved

9 years ago
Permalink

Comment has been collapsed.

wow I can't see how you did that ... but then again I'm still hypnotized by this mess and my brain hasn't stopped screaming DOES NOT COMPILE yet

9 years ago
Permalink

Comment has been collapsed.

+1

9 years ago
Permalink

Comment has been collapsed.

That's the thing about programming you get one little letter wrong and it no longer compiles!

9 years ago
Permalink

Comment has been collapsed.

Error: Could not find or load main class

9 years ago
Permalink

Comment has been collapsed.

Bump for solved

9 years ago
Permalink

Comment has been collapsed.

System.out.println("Bump");

9 years ago
Permalink

Comment has been collapsed.

Okay, I am Java developer and my eyes hurt after this code ;(

9 years ago
Permalink

Comment has been collapsed.

I'm sorry I've hurt your eyes :(

I hope you can still enjoy solving it though, bonus marks for not using your ide! :)

9 years ago
Permalink

Comment has been collapsed.

Error everywhere~

9 years ago
Permalink

Comment has been collapsed.

only 4 or 5 errors

9 years ago
Permalink

Comment has been collapsed.

I count 7 compile errors (using brain.exe as compiler), not including the ones due to missing classes. Plus some convention violations and pointless code fragments.

9 years ago
Permalink

Comment has been collapsed.

hmm I think you may need to upgrade your compiler :p

9 years ago
Permalink

Comment has been collapsed.

The only thing which makes sense to me is the UseCapitalOrder method. Although the code is painfully wrong, your intentions are clear... ;-)
First I thought that maybe the errors in the code are the hints, but there are way too many of them ^^

I'll wait for some hints...

9 years ago
Permalink

Comment has been collapsed.

OMG! What a mess!! I'm crying...

9 years ago
Permalink

Comment has been collapsed.

View attached image.
9 years ago
Permalink

Comment has been collapsed.

OMG, a fellowl!

9 years ago*
Permalink

Comment has been collapsed.

Bump for solved

9 years ago
Permalink

Comment has been collapsed.

Congratulations! I hope you enjoyed it :)

9 years ago
Permalink

Comment has been collapsed.

I think checkDoubleEquals could return something in the main branch without affecting the puzzle part.

9 years ago
Permalink

Comment has been collapsed.

lots of programmers without a sense of humor here...

View attached image.
9 years ago
Permalink

Comment has been collapsed.

Damn, I have no idea what's this puzzle is about and that's not because I can't java :P
I might want to see those hints first before I start bashing my head into my desk in helpless attempt to understand this little piece of code :D

In the meantime, enjoy a bump for not solved and waiting for tips ;)
Also: obligatory penguin gif

View attached image.
9 years ago
Permalink

Comment has been collapsed.

It's not so important what it does :)

In fact it doesn't even compile... because of a few typos :(

9 years ago
Permalink

Comment has been collapsed.

0.0;

9 years ago
Permalink

Comment has been collapsed.

i was literally doing some java coding a sec ago, i have no idea.. xd

9 years ago
Permalink

Comment has been collapsed.

Finally solved it ;-) Here, take a bump

9 years ago
Permalink

Comment has been collapsed.

Closed 9 years ago by aequitas737.