527 Posted Topics

Member Avatar for darklich13

I think it has something to do with the way the stream works-- if you call the method nextInt it will return the value on the line and attempt to the next line of code. I'm almost certain that because the type returned was not the type that should be …

Member Avatar for darklich13
0
257
Member Avatar for mariaczi_pl

Have you tried taking out the (void) in the constructor for Form1 and instead using Form1() ? I didn't know the compiler would accept non-pointer void arguments... it may be confusing it with a possible value? It's worth looking into..

Member Avatar for mariaczi_pl
0
192
Member Avatar for Alex Edwards

The error is listed in the title and then commented in main (last comment). The program runs but once it encounters the bool expression I overloaded, it seems as if the program pauses. I have a feeling it's a stack overload due to the way my function operates, but I …

Member Avatar for Alex Edwards
0
85
Member Avatar for marcosjp

[QUOTE=marcosjp;622925]Hello! As a college assignment, I'm finishing a small applet that communicates with a MySQL database (through a Java server via RMI - all this is part of the assignment). It's doing all it should except for one thing: in one of the tabs I included a JTable that lists …

Member Avatar for jwenting
0
128
Member Avatar for QuantNeeds

term = static_cast< double >((numerator/denominator)); is evaluating the double after doing int division within the cast. Try-- term = static_cast< double >(numerator)/denominator;

Member Avatar for QuantNeeds
0
616
Member Avatar for henpecked1

For your first question, why not make a class that extends from the vector class and overload the binary operator in your extended class to do the scalar-to-vector multiplication you want? Also, because your cycle method in your base class isn't virtual, it will call its own method of cycle, …

Member Avatar for bugmenot
0
143
Member Avatar for vasu_atri

A Frame is a component, and can accept other components. Think of components as chunks of data that can store data of each other... Here's the extension of JFrame java.lang.Object extended by java.awt.Component extended by java.awt.Container extended by java.awt.Window extended by java.awt.Frame extended by javax.swing.JFrame JFrame IS-A component and IS-A …

Member Avatar for Alex Edwards
0
94
Member Avatar for K?!

my first post! sorry to post in an old thread, but i have a question related to this. my situation is this: i want to make a paint-like program for a project in class, with "quick select colors," an array of colors, and an array of buttons (with only background …

Member Avatar for sciwizeh
0
2K
Member Avatar for WesFox13

This looks pretty straightforward... Basically you're using a pattern. Think of how you can use iteration (or recursion) to add the correct exponent and value to each section of the polynomial so you'll, only need a small block of code.

Member Avatar for Alex Edwards
0
102
Member Avatar for warrior16

Syntax for an array is simple-- [code=Java] ClassName_[] variableName = new ClassName_[SIZE_OF_ARRAY]; //or ClassName_ variableName[] = new ClassName_[SIZE_OF_ARRAY]; [/code] Where ClassName_ is a valid class name, variableName is the name you give the array and SIZE_OF_ARRAY is the amount of objects you want in the array. an example... [code=Java] String[] …

Member Avatar for Alex Edwards
0
130
Member Avatar for Futbol10

Keep in mind that swing is event-driven. In order to check a word for a character, you should create a method that iterates through each character of that word. public boolean charIsInWord(String word, char arg) { char[] charWord = word.toCharArray(); //iterate through the values of the char array and compare …

Member Avatar for Alex Edwards
0
100
Member Avatar for Alex Edwards

Ever since I have heard that you can generate classes during runtime (from say, a URL I suppose) and can use java.lang.Reflect to fire methods based on String input, I was wondering how the process is done?

Member Avatar for Ezzaral
0
105
Member Avatar for Futbol10

A lot of your code is drifting outside of a method or most likely outside of the init/start methods so you're going to have some errors trying to compile. Also if you want to change the way components look in your GUI you will have to use a different LayoutManager …

Member Avatar for Futbol10
0
111
Member Avatar for beelzibub

Remember how components work - you can add other components to them either through absolute positioning or through various layouts. You're still trying to add an object (which does NOT have any direct implementation of a LayoutManager) as a LayoutManager. Want to know why? First of all in order to …

Member Avatar for PoovenM
0
164
Member Avatar for vtsmokey88

I hope this doesn't sound too newby but have you tried looking into String Tokenizer? i'm assuming the information is in Strings so you can learn the StringTokenizer class to seperate your string based on a " " or space token. Oh wait it looks like you're using Javascript... I …

Member Avatar for stephen84s
0
92
Member Avatar for Software guy

Keep in mind what Graphics.drawLine does. You're trying to draw a point from i to i, and Math.sin(i) to Math.sin(i) so you're going to get something like a line due to the fact that your points aren't varying from x1 to x2 and y1 to y2. Try g.drawLine(i,(int)Math.sin(i),i + 2,(int)Math.sin(i))));

Member Avatar for PoovenM
0
2K
Member Avatar for zantex

Line 203 is the problem-- 203 type = console.nextLine().toUpperCase(); Change it to-- type = console.next().toUpperCase(); --and you should be golden.

Member Avatar for zantex
1
173
Member Avatar for rharvison

[QUOTE=Dameon;621742]VERY NEW?!?!? I took a full credit course on C++ wrote my exam and everything, And I couldnt hope to make a program like that without loads of help, and the power of ctrl c and ctrl v and the web. New at it, PAH![/QUOTE] Some people (like myself) are …

Member Avatar for Alex Edwards
0
155
Member Avatar for mysong

You should initialize your variables moPay and amount to zero and see if the program runs for you. Not saying that is what the values should be, but if you at least initialize them you can run the program and fix the mathematical errors.

Member Avatar for Alex Edwards
0
211
Member Avatar for beelzibub

It looks like he wants to use an inner class as a LayoutManager where when you add peices (or move or remove them) to the application it will add to the Panels listed in the LayoutManager. Seems like a good idea but your GridChessBoard doesnt implement the LayoutManager interface so …

Member Avatar for Alex Edwards
0
149
Member Avatar for Alex Edwards

I looked up the method class and thought that it might be useful, but unfortunately Method objects must be public to be invoked. I'm just curious of when I'd actually really need to use the Method class. Maybe to create an array that used a type of algorithm to fire …

Member Avatar for dkerberwra
0
86
Member Avatar for bjeff71

I'm fairly confused as to why you use an inventory4 class than an Inventory4 class... It just adds to the confusion. I'd also like to know how you got that compiler error. What line did you attempt to use Inventory5 (or Inventory5_5 ?)

Member Avatar for Manishbpl
0
163
Member Avatar for buddy1

I just briefly glanced your code and noticed an error... if( anArray[n] > anArray[n] ) Why are you comparing the same element to itself? And also why are you returning the same element in either case? Your line should look like-- if( anArray[n] > anArray[n+1] ) return anArray[n] else return …

Member Avatar for Duoas
0
110
Member Avatar for Nameste

In C++ main has to return an int (or possibly some kind of comprehensible value), not void. [code=cplusplus] #include<iostream> int main() { char cReply; int iNum, iSquare; std::cout << "Do you want to find the square of a number (y/n)?"; std::cin >> cReply; while(cReply == 'y') { std::cout << "Enter …

Member Avatar for Nameste
0
121
Member Avatar for Dannyo329

Seems like you'll either have to suffice with while loop that has some kind of waiting case, or you can learn to use threads. I don't know if there is a built-in timer to pause a process (such as a method) being read for a set amount of milliseconds, or …

Member Avatar for Alex Edwards
0
85
Member Avatar for Gibbie

Wouldn't using a preprocessor definition work? For example-- [code=cplusplus] #include <cstdlib> #include <iostream> #define COLUMN(arg) arg using namespace std; int main(int argc, char *argv[]) { typedef int column[5]; //anything marked with column before its variable name will be //an int array of size 5 column COLUMN(a); //an int array of …

Member Avatar for Alex Edwards
0
117
Member Avatar for Alex Edwards

Hello, I'm having an issue with a line of code that really doesn't seem that it should be giving me an error. Before posting, I've googled this error and looked at related links with no help whatsoever. Most of the "solutions" were for correctly-placed brackets or different names (since some …

Member Avatar for Alex Edwards
0
2K

The End.