Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~6K People Reached
Favorite Tags
Member Avatar for plasticfood

hi guys, I'm new to python and i can't seem to understand this one line of code right here: distance, coordinates = min([(someFunction(state, coordinates), coordinates) for coordinates in coordinatesList]) coordinatesList contains a list of paired coordinates (x,y). someFunction returns an int. My question is why isn't distance and coordinates contain …

Member Avatar for plasticfood
0
295
Member Avatar for plasticfood

Ok i've just starting learning css and html and i created a nav bar following a tutorial. HTML file--------------------- <div id = "wrapper"> <div id = "navmenu"> <ul> <li><a href="#">ITEM</a> <ul> <li> <a href = "#">items</a> </li> </ul> </li> </ul> <ul> <li><a href="#">ITEM</a> <ul> <li> <a href = "#">item</a> </li> …

Member Avatar for JorgeM
0
141
Member Avatar for plasticfood

public class QS { public static <T extends Comparable<? super T>> T[] quickSort(T[]array) { return doSort(array, 0, array.length - 1); } //some other methods................. public static void main(String [] args){ QS qs = new QS(); int [] nums = {4,7,23,1,2,45,23,11}; qs.quickSort(nums);//gives error } } I am getting an error in …

Member Avatar for plasticfood
0
133
Member Avatar for plasticfood

So i have a class that takes 2 generics types: public class Something<K,V>.... In another class, i'm trying to create an array of Something objects. how do i do this? i'm getting an error with this: Something <K,V>[] s = (K,V[]) new Object[size];

Member Avatar for plasticfood
0
213
Member Avatar for plasticfood

serious noob question, but i'm following my android book and it is doing something with a class that extends list activity. is that a file that i have to create on my own, or is that provided once i create a new android project? i can't seem to find it.

Member Avatar for plasticfood
0
85
Member Avatar for plasticfood

i have a private Node class with a getValue() method that returns the Node's value which is of generic type. In another class i've tried doing this: T tempItem = null; ----also generic tempItem = currentNode.getValue(); I get a complier error unless I cast it like this: tempItem = (T) …

Member Avatar for plasticfood
0
230
Member Avatar for pikalife

What should I write within a while loop that allows me to keep on divding a number by 2 until it meets certain conditions. for example while(condition) { //what should i write here to have a double that divides by 2 until it meets the condition. }

Member Avatar for JamesCherrill
0
149
Member Avatar for plasticfood

my program includes pictures and audio, do i have add that to my project and then create a jar file? or i just have to include the source file and that's it?

Member Avatar for plasticfood
0
175
Member Avatar for plasticfood

i'm trying to write a game that show a background and a player on screen simultaneously using 2 different classes. here are the relevant parts of the program, or at least i think [code]public WorkingTitle2(){ super("Working Title"); setSize(550,429); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); loadPictures(); loadSounds(); pp = new PaintP(); pb = new PaintB(); add(pb); …

Member Avatar for plasticfood
0
142
Member Avatar for plasticfood

i've made this little game but the image keeps on flickering. i've read about double buffering online, but i really don't know how to implement the code into my game. here's some of the source code from the constructor and paint method: [code] public Game(){ super("test"); setSize(495,429); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); try{ …

Member Avatar for NormR1
0
301
Member Avatar for plasticfood

i am not saying that all of my jar files are not working. in fact, all of them do work so far except for this one game that i've made. it runs perfectly in my editor, but its jar file will not execute. i checked its MANIFEST.mf file and the …

Member Avatar for plasticfood
0
153
Member Avatar for plasticfood

i don't know what happened, but i was running an applet that i made on a webpage and it works fine. i have the latest JRE and i am running firefox 4. then i've made some changes to the applet, tested it, it works, and copy and paste the class …

Member Avatar for plasticfood
0
322
Member Avatar for plasticfood

[CODE]if(count == 4){ qFinal.enqueue(q.peek()); if(count3 == 0){ System.out.println(qFinal); break; } else{ sort(qFinal); } } [/CODE] this code is inside a while loop, and with the break statement, it should break out of the loop right? instead i think the program also executes the sort(qFinal) method b/c after it prints qFinal …

Member Avatar for masijade
0
191
Member Avatar for plasticfood

i am getting an error in this. basically it sorts a queue in abc order. [CODE]public class Queue2{ public static void main(String [] args){ LinkedQueue q = new LinkedQueue(); q.enqueue("d"); q.enqueue("v"); q.enqueue("b"); q.enqueue("a"); q.enqueue("d"); System.out.println(q); System.out.println("----------------"); sort(q); } public static void sort(LinkedQueue q){ LinkedQueue qFinal = new LinkedQueue(); int count …

0
73
Member Avatar for plasticfood

this is a linked list based queue private class Node { String value; Node next; Node(String val, Node n) { value = val; next = n; } } public String dequeue() { if (empty()) throw new EmptyQueueException(); else { String value = front.value; front = front.next; if (front == null) …

0
64
Member Avatar for plasticfood

this assignment has stomped me. i thought it about long and hard and can't imagine how would i edit the quicksort to sort an array-based queue object. i'm required to use an array-based queue class which has only 3 methods: enqueue(), dequeue(), and peek(). they're pretty self explanatory. i cannot …

0
70
Member Avatar for plasticfood

ok i have this assignment which i'm just having problems with the iterator part of it. from the [B]ListType [/B]class, this is what i wrote: [CODE] public Iterator iterator(){ return new OrderedStringListTypeIterator(list); } [/CODE] this code is from the textbook which idk how they got theirs to work, but... [CODE]import …

0
67
Member Avatar for plasticfood

[CODE]public static void fun(int x){ System.out.println(x); x--; if(x > 0){ fun(x); } System.out.println("returning " + x); } [/CODE] in the main class: fun(5); [U]output:[/U] 5 4 3 2 1 returning 0 returning 1 returning 2 returning 3 returning 4 --------------------------------------- what i don't get is how the print statement is …

Member Avatar for jon.kiparsky
0
154
Member Avatar for plasticfood

ok i got this assignment, and i'm a bit confused about what this method is supposed to do. i have to create a "setLab" method and accept a Grade object (which is already done and provided). this is what i got so far: [CODE]public class CourseGrades{ private Grade [] grades …

Member Avatar for plasticfood
0
110
Member Avatar for plasticfood

ok so the program gets a list of numbers, and it counts how many times a number is entered. [CODE]for(int i = 0; i < numList.size(); i++){ for(int j = numList.size() - 1; j > i; j--){ if(numList.get(i) == numList.get(j)){ count++; numList.remove(j); } } System.out.println(numList.get(i) +" " + count); count …

Member Avatar for plasticfood
0
103
Member Avatar for plasticfood

[CODE] vowels = wordcount.vowelNum(); //counts the vowels consonants = wordcount.consNum(); //counts the consonants, this is not working properly. [/CODE] the consNum() method: [CODE] int length = word.length(); for(int i = 0; i < length; i++){ if(word.charAt(i) == 'a' || word.charAt(i) == 'u'|| word.charAt(i) == 'i'|| word.charAt(i) == 'e'|| word.charAt(i) == …

Member Avatar for plasticfood
0
100
Member Avatar for plasticfood

[CODE]for(int i = 0; i < floorNum; i++){ if(floorNum == 12){ continue; { statements; statements; statements; }[/CODE] ------------------- if there anything wrong with this statement? i've tried using a while loop and the continue statement would work and skip number 12, but this doesn't work.

Member Avatar for plasticfood
0
84
Member Avatar for plasticfood

this program just prints out prime number within the range of the for loop. however it doesn't print anything. [CODE] boolean prime; for(int i = 11; i < 100; i++){ prime = isPrime(i); //this method works as i tested it before if(prime){ System.out.println(i); } } [/CODE] everytime i run this …

Member Avatar for plasticfood
0
114
Member Avatar for plasticfood
Member Avatar for frankel81

I just dont know where to start on this. Can anyone lend me a hand? 4- Write a Java program to create the following array that hold the salaries of employees: 1550.8 2439.5 1800.75 2890.0 The company wants to give the employees a bonus of 30% of their initial salary, …

Member Avatar for plasticfood
0
146
Member Avatar for plasticfood

[CODE]System.out.println("what is your name? "); String name = kb.nextLine(); for(int i = 0; i < member2.size(); i++){ if(member2.get(i).equals(name)){ System.out.println(name + " is a member. "); break; } else{ System.out.println(name +" is not a member. "); break; } [/CODE] i did a system.out.println on the member2 arraylist (String arraylist) and it …

Member Avatar for plasticfood
0
115
Member Avatar for plasticfood

for example, i have a txt file that reads: number of items: 2 number of zombies: 3 .... i want to write a method that increments just the numbers, and leave the "number of items" and "number of zombies" alone. is there any way to do this? i can easily …

Member Avatar for plasticfood
0
108
Member Avatar for plasticfood

[CODE]else if(choice == 3){ System.out.println("what is your name? "); String name = kb.nextLine(); boolean x = Member.checkMember(name); System.out.println(x); } [/CODE] when i run this, it prints "what is your name?" and instead of waiting for me type in something, it just skips that part and go ahead and prints x. …

Member Avatar for javaAddict
0
113
Member Avatar for plasticfood

i wrote a program that calculates how many coins that a vending machine splits out and such, and it does work but i can't figure how it works. at the time, i was sure of the logic, but now i can't understand how this is possible. [CODE] change = (amountPaid …

Member Avatar for masijade
0
154
Member Avatar for plasticfood

[CODE]public static String strCap(String str){ //capitalizes the first letter of the string String newStr1 = str.replace(str.charAt(0), Character.toUpperCase(str.charAt(0))); int position = str.indexOf(". "); // looks for a period followed by a space while(position != -1){ newStr1 = newStr1.replace(newStr1.charAt(position + 2), Character.toUpperCase(newStr1.charAt(position + 2))); position = str.indexOf(". ", position+1); } return newStr1; …

Member Avatar for kola.naresh
0
88