if you can't do the work you deserve to fail it
if you can't do the work you deserve to fail it
Originally Posted by evilbau
Sure.
haha well at least you admit it. cheat away! ~Originally Posted by Weltall
drop the course, and retake it next semester. problem solve.
ctrl+c ctrl+v from book doesn't mean you know how to write the program. end of story.
That's how I've learned java so far, ran code snippits from the book till I could figure out what I wanted to do with the combination of them, but 95% of the time that's how you have to learn it at universities with shit professors. However, I want to learn some C# or another language, anyone have suggestions?Originally Posted by Osede
If you're already proficient in object oriented programming you could try something like C++ which is pretty easy to pickup immediatly and there is a lot you can do with it. If you don't want to do object oriented programming you could try straight C, which is pretty awckward at first but has a lot to give you as far as technique goes. I developed way better style in my C class then in my Java class. .NET is also kind of interesting to deal with if you get into it, i've not taken a formal class on it though so I couldn't say anything else. I do know some people love .NET so maybe someone will help me on my recomending it.Originally Posted by Korietsu
Best to go pickup a good text on the subject and just code on your own if you can't find a class on it. Thats how I did C++. I <3 O'Reily Books. (Not too Advanced but they're good into to give you a decent introduction without too much fluff.)
If you know java, you pretty much know C# at 80%. The rest is just to know what method names/libraries to use instead of the java ones.Originally Posted by Korietsu
That's not too bad then. I should probably learn .NET then. I want to learn some unix based stuff, but I'll deal with that later in my upper level courses. I'd prefer to do less programming, but I know I need to be proficient in as many languages as possible, I enjoy the EE side of my CE degree plan more than anything else.Originally Posted by octopus
You should just post the problem here instead of straight up offering to just pay people to do your work. That just makes people assume the worse and in this case they were right because it sounds like you don't deserve the A if you skated your way through the course...
I did something similar to this(asking for help on BG) a few years ago now, maybe 1 and a half going on two years? Anyway, I asked for help with a certain project that was giving me trouble, just outputting some stars in a specific shape and I couldn't for the life of me figure it out; I didn't offer to pay to have someone else do it, I posted my errors iirc and asked for suggestions. Aurik showed up and helped pretty early on and I understood my mistake eventually and went on to finish the course fine. Now, from the OP it sounds like you aren't even interested in doing well you just want to get the work done without the effort which is a big turnoff to anyone who might've considered helping you, even with money as motivation.
The point of all the shit I just said? You went about this all wrong, you can try again and just post the problem and your thoughts and some solutions you may have considered and then people will help you for free. Don't abuse the community though and condescend saying you'll simply pay someone to do your work for you.
While im at it, I might as well ask a java related question. Other than using a master list model with the model method, how would I remove an item from a JList, by its selection index? I had to reverse engineer it for a program due a night ago, and I might want to append it to the teacher if the TA is a bitch grading.
http://java.sun.com/j2se/1.5.0/docs/api/Originally Posted by Korietsu
?
You have the vector that represents the JList data? Just remove the item from the vector and run setListData again.Originally Posted by Korietsu
He clearly stated that he's not using a modelOriginally Posted by octopus
Anyways, like Maguspk linked, just check the javadoc.
I pieced through the API to try and find a method to remove items from a list, but I couldn't find anything that didn't involve using the DefaultListModel method, which I tried putting it all over the program to see if I could get the damned thing to work, and got bugged out each time. Just don't know if netbeans didn't like it or what, I didn't have time to attempt it in JCreator.Originally Posted by Maguspk
Originally Posted by Korietsu
All Java IDEs are going to use the same compiler to verify, so if NetBeans doesn't like what you did, it's wrong. I suggest researching how the actual JList class works, you seem to be misunderstanding its usage.
If I had the knowledge and someone would offer me monies to do an homework for an hour, I'd do it.
I mean seriously, I didn't know there was so many righteous people here... unless OP already got offers!
Did you try building the vector from the getModel() method? From the ListModel it returns, you can use getSize() to get the size, then use a for loop and getElementAt(index), you can build the vector and then setListData().
Here's what I'm using currently to get the data and transfer the data to my "cart" list for my online shopping program.
Now, as you can see, I've used the setListData method to set my list over via an array as we were taught in the text we're using and via the professor's example programs, however, when I try to build something using code likeCode:int[] selectionIndices = bookList.getSelectedIndices(); String[] listTwo = new String[selectionIndices.length]; double sumOfCosts = 0; for (int i = 0; i < selectionIndices.length; i++) { listTwo[i] = bookListData[ selectionIndices[i] ]; } cart.setListData(listTwo); for (int i = 0; i < selectionIndices.length; i++) { sumOfCosts += bookCost[ selectionIndices[i] ]; } String sumOfCostsStr = String.valueOf(sumOfCosts); sub.setText("$ " + sumOfCostsStr); double taxTotal = sumOfCosts * 1.06; total.setText("$ " + taxTotal);
I can't even the the IDE past creating the model so that I can append anything in the second list, otherwise I could have cut my amount of code down and done it with much less hassle.Code:DefaultListModel model = new DefaultListModel(); JList list = new JList(model); // Initialize the list with items String[] items = {"A", "B", "C", "D"}; for (int i=0; i<items.length; i++) { model.add(i, items[i]); } // Append an item int pos = list.getModel().getSize(); model.add(pos, "E"); // Insert an item at the beginning pos = 0; model.add(pos, "a"); This method replaces an item: // Replace the 2nd item pos = 1; model.set(pos, "b"); These methods are used to remove items: // Remove the first item pos = 0; model.remove(pos); // Remove the last item pos = model.getSize()-1; if (pos >= 0) { model.remove(pos); } // Remove all items model.clear();
Edit, forgot the second part, what im doing to append right now is to have them select what they want to keep, rather than being able to remove it as I can't find it in the API or the text. So, I have this code, where the array clearList is blank, and the listThree makes the list again by using the .setlListData method.Code:private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { int[] selectionIndicesTwo = cart.getSelectedIndices(); String[] listThree = new String[selectionIndicesTwo.length]; double sumOfCosts = 0; for (int k = 0; k < selectionIndicesTwo.length; k++) { listThree[k] = bookListData[ selectionIndicesTwo[k] ]; } cart.setListData(clearList); cart.setListData(listThree); for (int i = 0; i < selectionIndicesTwo.length; i++) { sumOfCosts += bookCost[ selectionIndicesTwo[i] ]; } String sumOfCostsStr = String.valueOf(sumOfCosts); sub.setText("$ " + sumOfCostsStr); double taxTotal = sumOfCosts * 1.06; total.setText("$ " + taxTotal); }
I guess it's a bit hard to understand what you're trying to do without being able to play with it. But anyway - which line(s) is the IDE complaining within the code? and what error?
The IDE wont even let me create the list model, with the DefaultListModel model = new DefaultListModel(); code. Its giving me a cannot find symbol error, saying it cannot find the class DefaultListModel, which is coded in the damned API --;. If you want I can send you the file via aim or if the PM's here support it, via PM.Originally Posted by octopus