This is impossible. The gap between Programming 1 and Programmin 2 is ridiculous.
My first assignment is to make an array of 10 bathroom stalls and have a person (x) fill out a center spot randomly, then fill out another spot either to the left or the right near the middle randomly, etc etc until all the spots are filled.
The second question is to make an arrayList with sequences in order to append/merge/merge without copying two arrayLists.
The third question is to partition any given number. I actually managed to code this one, but instead of my output being:
5 41 311 2111 11111
it is 5 14 113 1112 11111
I don't think anyone in my class is getting this. The difficulty is so much higher, how can anyone expect us to jump so far ahead? Can anyone help me? Any guides? Because I am lost as fuck.
Especially with the whole sequencing, which I'm not even sure what that means.
Or the fucking stalls. I only managed to print the array of empty stalls, so I basically started it only.
Christopher Martin
What language?
Try solving it on paper first then transfer that to code
Julian Long
Java.
What do you mean solve on paper?
I feel like I don't know anything. Literally everything I need to do I've had to look up on the internet where people pull RANDOM SYNTAX OUT OF THEIR ASS
like WTF is a sequence?!!??!?!?!!?!?!?! WHY can't I just print out a sequence? Why does EVERYTHING have to result in an error?
Why am I so shitty at this? How is it that other almost IMMEDIATELy know how to solve a problem.
Like holy shit I can't fucking work in this field this is literally impossible.
Kevin Carter
Professional programmer here. Everytime I've tried to lay out a problem in paper I've failed miserably.
Programming is all about having good intuition for problems, being able to shit out a base program that supposedly does what you want it to do and then you execute it to see if the results are what you want.
When it doesn't do what you want you put a billion breaks in the code and manually check how every variable is behaving.
That google movie where the programmers were scribling shit on windows instead of getting in the fucking computer is nothing but fantasy. Nobody does that.
Jace Thompson
Didnt really pay much attention to what you wrote but seems easy
Jose Martinez
But what the fuck man. How do I get a grasp of even remotely knowing what the fuck I'm doing?
Jordan Ramirez
Im not really sure about the bathroom stall one because i dont understand what you posted. For the partion one why dont you just store the current output in an array, then output the array in reverse order? I know there is a much simpler solution to this if i could see your code but with what you gave us thats the easiest solution i see.
Jayden Brooks
Not sure what you mean with the first one. this code picks a random spot and then starts filling stalls left or right from it.
boolean[] arr = new boolean[10]; int leftIdx=-1; int rightIdx=1;
int start = //random gen shit of choice while(!bathroomsFull()) { switch(//random gen between 1-2) { case 0: //Left if(start+leftIdx < 0) //Out of bounds continue; arr[start+leftIdx] = true; leftIdx--; break; case 1: if(start+rightIdx > 9) //Out of bounds continue; arr[start+rightIdx] = true; rightIdx++; break; } }
private boolean bathroomsFull() { for(int i=0; i
Alexander Lewis
>How do I get a grasp of even remotely knowing what the fuck I'm doing?
That is when intuition comes in. You should always know how a program 'looks like' naturally. If you can't do that then drop out.
I'd help you if I understand what the fuck you are being asked. What does it mean to partition a number ffs?
In what context is sequence being used and why do you need an arrayList?
etc. etc.
Zachary Adams
the break in bathroomsFull should be return false; and the switch should generate 0 or 1 not between 1-2