1,678 Posted Topics
Its basically telling me it doesn't know wth the pow() function is. But at the top of the file, I have #include<math.h> so shouldn't that work? And right after I have the #include, I declared the function definition of bintodec, so that isn't the problem either. [CODE]int bintodec(char* array){ int … | |
Re: Suggestions: 1. Where your LeatherBlueDot constructor (the one with 6 arguments) calls super, the arguments you have in super don't exist. item, name, balls, prices, and subs are not defined in the LeatherBlueDot class. You probably meant to say super( itemNumber, itemName, ballCount, ballPrice, subTotal ); 2. You have the … | |
Re: I've never used MouseListener, but your mouseDragged code is wrong. "e" refers to a MouseEvent object, NOT your rectangle. Lets say you had an Object that represented your rectangle, here's what your code should look similar to. [CODE] //Note this shouldn't be of type object, I'm just showing that it … | |
Re: Chaster is correct, you must define your variables before you use them. A variable in computer science is the same as it is in normal algebra. For example, x and y are commonly used variables in algebra. Similarly, in Java programming, you can define your own variables. To define a … | |
Re: [url]http://www.csee.umbc.edu/courses/undergraduate/341/fall08/Lectures/Trees/BST.pdf[/url] Read those lecture notes. They literally have the remove method in them. So assuming the rest of your code is correct, look at the remove method in those notes and compared it to your delete method. Once you figure out whats different, try to figure out why your code … | |
Re: Write a while loop that loops indefinitely while the user does not enter a specific value. Inside that while loop, you should simply print out something like "Enter your calculation or enter X to quit the program." Then, it should read in the user's input using scanf (might be other … | |
Re: What is UserInput.prompt? Use Scanner to get input from the user, unless you were directed otherwise by your instructor. For example, Scanner userInput = new Scanner(System.in); //System.in is connected to the keyboard by default, so the statement above will create a Scanner object called userInput that allows you to read … | |
Re: Its because hasNextLine() will return true if there is a next line, even if that line does NOT contain any information. In other words, if there is a newline character, hasNextLine() will return true. Whereas hasNext() will only return true if there is a next token. A token is defined … | |
Re: One good way to do this would be the following [CODE] //assuming your Scanner object is called input do{ int choice = -1; System.out.println(//Print out your choices here); if(input.hasNextInt()){ choice = input.nextInt(); //call some method that does the calculations here. // the method will take 'choice' as its argument //so … | |
Re: [CODE] #include <stdlib.h> #include <stdio.h> int main(){ int nrEvens = 0; int nrOdds = 0; int nrInputs = 0; int currentValue; while(nrInputs < 20){ printf("Enter a number: "); scanf("%d", ¤tValue); if (currentValue % 2 == 0){ nrEvens++ } else{ nrOdds++; } nrInputs++; } printf("There were %d even values entered and … | |
Re: [QUOTE=bahr_alhalak;723545]this is the file bellow .. download and explain what u understand my frind[/QUOTE] This (your existence on this site) must be some kind of a sociology experiment. If so, I guess the goal would be to figure out how much help you can receive from people while disregarding what … | |
Re: If you are using the LinkedList class, use yourObjectName.remove(index); . It will do all the necessary operations for you, such as making the previous and next nodes point to each other. Since I see that you're not using that class, I would strongly recommend that you do so. Otherwise, you're … | |
Re: Are you dense? Stultuske just posted a number of different things to help you. If you don't understand a particular one, try to research it online or ask him to elaborate here. If you don't know any Java at all, which it seems like you do not, find a good … | |
Re: [QUOTE=java-clueless;722591] [code] //Fig.2.7:Inventory.java //Inventory program public class Inventory { //main method begins execution of Java application public static void main(String[] args) { //You need to create a Scanner object. Below, we create a Scanner object called 'input'. //We use System.in because we want to read input from the keyboard. Scanner … | |
I'm confused how GridBagLayout can be used as if it was GridLayout(0,2). For example, I would like to lay out components like this: Label TextFieldForLabel Label TextFieldForLabel Label TextFieldForLabel Label TextFieldForLabel I thought by making a GridBagConstraints() Object, then setting the gridx and gridy variables, this could be accomplished (Java … | |
Re: [QUOTE=DaMoogle;721929]the BankAccount constructor should call a deposit method to allow the user to add some money if he or she wants to. However, the parameter which passes the value to the deposit method is not available for this constructor and I know that I can not simply add that parameter … | |
Re: If this means anything to anyone here I think it will be a small miracle. | |
Re: Considering that there is a class available that will do this for you, LinkedList, I'm assuming this is some sort of assignment? (Which is fine) Anyway... pseudocode to do this -Given the index you want to remove -set the [I]node at the[/I] previous index to point to the node at … | |
Re: You would keep a pointer to the String that you wish to store it in and concatenate your 'new' user entry onto whatever the String's current contents are. OR you could make the function 'return' whatever the user entered as a String, and concatenate that entry with whats stored in … | |
Re: If it is public, then you can use Classname.variableName to refer to it. In this case, that means saying C.q This only applies if they are in the same package, which in your case, they are. If they were in a different package, you could say packageName.Classname.Variablename | |
Re: If you're only allowed to use the methods defined in the MyArrayList class, then that depends entirely on what methods are in that class. I'm assuming it has a push() and pop() method, so you can "fake" the peek method by pop()ing something off, saving it into a variable, and … | |
Re: Correct me if I'm wrong, but it seems like you just posted an entire assignment, but didn't give any insight on how you've been trying to solve the problem - or even [I]what[/I] the problem is. So we can only assume that you didn't actually attempt the assignment. I'd recommend … | |
All I can think is that there's something fundamentally wrong with how I programmed my GUIs. I have a program that initially displays a GUI which has 6 buttons. Each of these buttons, when clicked, displays a GUI. One of these GUIs in particular is a JTable of "Teams". Each … | |
Ok so lets say I have any GUI that needs its contents changed while it is running, so that it will re-display the new contents. An example would be a JTable that just lists things from an ArrayList. So if I had an ArrayList<GroceryList> my JTable might have Cheese Crackers … | |
Re: Errors - Syntax/compiler errors, Runtime errors, Logic errors There you go. Now you can look them up and learn about them on your own. | |
Re: if you register your JButtons like this buttonName.addActionListener(this); then they will fire an event when they are clicked. Also, you will need for your class to implement ActionListener. In the method actionPerfmored, do something likr Object source = e.getSource(); // where e is the ActionEvent object being passed in. And … | |
Re: Your question is very confusing. Here is an example of how to set up a Socket, which is one end of a connection/pipeline to send stuff back and forth, basically. If you want the client to be on your own computer, then it would be 'localhost'. Otherwise, the String hostname … | |
Re: Also, I could be wrong, but it seems like you never set duplicate back to false. You will need to do that, otherwise once it is set to true, everything in your file will be treated like it is a duplicate. |
The End.