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

44 Posted Topics

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
395
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
142
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
136
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
218
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
86
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
234
Member Avatar for pikalife
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
177
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
144
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
303
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
156
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
326
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
193
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
75
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
66
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
72
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
69
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
156
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
114
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
106
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
102
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
88
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
118
Member Avatar for plasticfood
Member Avatar for frankel81

[CODE]double [] salary = new double [4]; salary[0] = 1550.8; salary[1] = 2439.5; salary[2] = 1800.75; salary[3] = 2890.0; //show the array before the bonus// for(int i = 0; i < 4; i++){ System.out.println(salary[i]); } System.out.println("----- with bonus-------"); double bonus = 0; for(int i = 0; i<4; i++){ bonus = …

Member Avatar for plasticfood
0
152
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
117
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
114
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
115
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
157
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
92
Member Avatar for plasticfood

here is some code from one class... [CODE]public boolean ticketStatus(){ if (fine > 0){ status = true; } else{ status = false; } return status; } [/CODE] and this is from another class... [CODE]public void getTicket(){ if (parkingticket.ticketStatus()){ toString(); } else{ System.out.println("you do not have a ticket. "); } } …

Member Avatar for Taywin
0
122
Member Avatar for plasticfood

[CODE]public double returnTotalFine(){ if (parkingmeter.returnPurchasedMins() >= parkedcar.returnMinsParked()){ fine = 0; } else if (parkingmeter.returnPurchasedMins() - parkedcar.returnMinsParked() <= 60){ fine = 25; } else{ fine = (25 + (10 * (parkedcar.returnMinsParked() / 60.0))); } return fine; } [/CODE] this is the toString method from the same class as above: [CODE]public String …

Member Avatar for plasticfood
0
60
Member Avatar for plasticfood

[CODE] String[] names = new String[namesListSet.size()]; int[] nums = new int[namestimesSet.size()]; namesListSet.toArray(names); [B]namestimesSet.toArray(nums);[/B] for (String s : names) { System.out.print(s); } [/CODE] i'm getting an error on the bold part. getting symbol not found.

Member Avatar for plasticfood
0
81
Member Avatar for plasticfood

[CODE] String names1 = ""; System.out.println("enter names: "); names1 = kb.next(); while (names1 != "stop") { System.out.println("enter names: "); names1 = kb.next(); namesList.add(names1); } [/CODE] everytime i type "stop," the program keeps running...

Member Avatar for plasticfood
0
64
Member Avatar for plasticfood

[CODE] int [] wronglist = new int [incorrect]; for (int i = 0; i < 6; i++){ for (int j = 0; j < i; j++){ if (studentArray[i] != ansArray[i]) wronglist[i] = (j+1); [/CODE] ok i'm trying to write a program that figures out what number did the user got …

Member Avatar for plasticfood
0
303
Member Avatar for plasticfood

[CODE]public static int totalCorrect(String [] studentArray, String [] ansArray){ int numCorrect = 0; for (int i = 0; i < 6; i++){ if (studentArray[i] == ansArray[i]) numCorrect += 1; } return numCorrect; } [/CODE] instead of returning the actual number, it always return 0. here is the whole program: [CODE]import …

Member Avatar for plasticfood
0
131
Member Avatar for plasticfood

[CODE]import java.util.Scanner; public class Highest{ public static void main (String [] args){ Scanner kb = new Scanner(System.in); int scores [] = new int[3]; String names [] = new String [3]; int highest = scores [0]; String names1 = names [0]; for (int i = 0; i<3; i++){ System.out.println("enter name and …

Member Avatar for NormR1
0
120
Member Avatar for plasticfood

[CODE]double wholeCost = kb.nextDouble(); double markupPercent = kb.nextDouble(); double markup = markupPercent/100.0; double retailT = calculateRetail(wholeCost, markup); System.out.println(retailT); public static double calculateRetail(double num1, double num2){ double markupPrice = ((num1 * num2)+ num1); return markupPrice;} [/CODE] i've been staring at this and can't figure what is wrong with it. the compiler …

Member Avatar for plasticfood
0
76
Member Avatar for plasticfood

[CODE]import java.util.Scanner; public class Inti{ public static void main (String [] args){ Scanner kb = new Scanner(System.in); System.out.println("enter name: "); String input = kb.nextLine(); char name1 = input.charAt(0); int blank = input.indexOf(' '+1); char name2 = input.charAt(blank); int lastBlank = input.lastIndexOf(' '+1); char name3 = input.charAt(lastBlank); System.out.println(name1 + "\n" + …

Member Avatar for plasticfood
0
108
Member Avatar for plasticfood

particularly from a txt file. for example if the file reads "name ###-####-#### address" all in one single line. how do i put all three items in three separate variables and print them?

Member Avatar for CrazyDieter
0
132
Member Avatar for plasticfood

ok i need to write something like [CODE] if { days > 5 && minutes > 5 } [/CODE] basically i need minutes to be around 5 to 10, and cannot be greater than 10. how do i do write this within the same if statement?

Member Avatar for plasticfood
0
101
Member Avatar for plasticfood

ok i am writing a program that ask for the amount total and amount tender. then i'm supposed to calculate a combined amount of coins and dollars to make up the change amount. i know how to split out the dollar amount, but i'm stuck on how to calculate the …

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

ok i'm tryiing to convert a double into a string to get the 1st character of that number. [CODE] change = (amountPaid - total); String dollars = Double.toString(change); String firstNum = dollars.charAt(0); [/CODE] i got an imcompatiable type error on that part. change, amountPaid, total are double.

Member Avatar for NormR1
0
51
Member Avatar for plasticfood

[CODE]import wx class bucky(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Frame aka window', size=(400,300)) panel=wx.Panel(self) status=self.CreateStatusBar() menubar=wx.MenuBar() first=wx.Menu() second=wx.Menu() first.Append(wx.NewId(),"new window") first.Append(wx.NewId(),"Open...") menubar.Append(first,"File") menubar.Append(second,"edit") self.SetMenuBar(menubar) if __name__=='__main__': app=wx.PySimpleApp() Frame=bucky(parent=None, id=-1) Frame.Show() app.MainLoop() [/CODE] when i run this program, i get a "self is not defined in status=self.CreateStatusBar()". so i erased that part, and it …

Member Avatar for plasticfood
0
153

The End.