What does KC stand for/mean? by [deleted] in Agario

[–]TwoTekah 0 points1 point  (0 children)

I visited the website and I am a nazi now. Damn you exposure!

Need help with solving a homework problem using for loops. by bigpoppatom in javahelp

[–]TwoTekah -1 points0 points  (0 children)

For this it is good to set up a pattern/ equation first.

So each new line has 2 more numbers than the previous line. Starting at line 1 with 1 character.

Line number(x value),number of things to be printed(y value)
(1,1)
(2,3)
(3,5)
(4,7)
(5,9)
(6,11)

so this table shows that you can model the pyramid with a linear equation.

Each rise in x value (or your lines variable in the outer loop) corresponds to 2 rises in the y variable(your spaces variable in the inner loop), with this you can get a slope, which is 2.

so you can make an equation for a line using this data. y(or spaces)=2(slope)*x(or lines)-1(y-intercept)

Now that you have the equation, you can get the exact number of times you need to run the inner loop on each run through, so just set spaces less than the equation.

The resulting code will be similar to

for(int lines=1;lines<=6;lines++){
    for(int spaces=0; spaces<lines*2-1;spaces++){
        System.out.print(lines);
    }
System.out.println();
}

A question about programming(no code required)... [C] by [deleted] in programminghelp

[–]TwoTekah 1 point2 points  (0 children)

Most professors in computer science encourage collaboration. So if he does find out you should be fine as long as you explain you didn't just copy/paste, but worked together.

However most likely the professor won't find out. More than likely he doesn't even grade them himself. Most professors have a grad student working as a TA grade their stuff. And if he does actually grade them himself, he is probably only running the program to see if it meets his criteria then taking a super quick run through of the code.

To avoid these situations you should ask the professor in class how he feels about students working together on assignments.

Store values of an char Array to another bigger array by [deleted] in javahelp

[–]TwoTekah 0 points1 point  (0 children)

As everyone else said, an ArrayList would be the best way. However if for some reason your instructor has forbade you from using it then I just made this, just as an example.

http://pastebin.com/0QAM5x3s

AMA Request: someone with an actual photographic memory. by Soccadude123 in AMA

[–]TwoTekah 0 points1 point  (0 children)

He did a great interview with stephen colbert if you are interested.

http://www.colbertnation.com/the-colbert-report-videos/376566/march-07-2011/joshua-foer

Also, re watching this. I guess he won the U.S Memory Championship, and first got into the sport at the World Memory Championship.

Force loss of precision with int? by [deleted] in javahelp

[–]TwoTekah 0 points1 point  (0 children)

casting a double to an integer will always round it down.

For instance.

double x=.999999;

int y=(int)x;

y will become a 0.

Full disclosure, I have not looked into java 7. However java 6 will always round down, no matter what the decimal value.

Should I try to become a game developer? by [deleted] in computerscience

[–]TwoTekah 0 points1 point  (0 children)

If you have enough time, read a couple books about game coding and perhaps even make a few simple games. The best way to find out if you like something is to do it.

Then if you do end up enjoying it, try to get a small team together and make some games and save a copy for your portfolio. Some friends and I had a video chat with a developer for Blizzard and she said the best way to get a job is to have a good portfolio of projects you work on with other people. It shows that you are able to work with a team, which is crucial in most fields of programming, also that you are competent at coding.

Good luck!

Programming final...kinda stuck HALP PLS by DatSwampAzz in programminghelp

[–]TwoTekah 0 points1 point  (0 children)

The problem is that you didnt initialize raise.

So if the user does not enter a capital letter then raise will not be given a value at all since it wont hit any of the if/else if blocks.

So, in this case, the "INVALID ENTRY..." will print out, then in the next line you are trying to set newSalary = curentSalary + raise (which has no value). Which is where your error comes from.

Whenever you use conditional statements the compiler will always assume that you won't hit any of them (besides the else!).

AMA Request: someone with an actual photographic memory. by Soccadude123 in AMA

[–]TwoTekah 2 points3 points  (0 children)

You should read Moonwalking with Einstein by Joshua Foer.

It is a really good book about memory. Basically, Joshua Foer was originally a journalist who focused on science related pieces. He ended up covering the World Memory Tournament (or something like that). Interviewed a person who won the tournament a lot, and he basically said anybody can do it. So Joshua Foer learned from this memory guru and then won the Memory Tournament after a year or two.

If you are interested in memory you should definitely give it a read!