Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
0 Endorsements
~17.1K People Reached
Favorite Forums
Favorite Tags

57 Posted Topics

Member Avatar for degamer106

Hmm I was lookin through a recursion program in this book i have here and the only thing I'm having trouble with is the modulus operator. I know that it returns the remainder of 2 numbers. But, suppose I have this: x % y If x > y then the …

Member Avatar for Shankye
-1
266
Member Avatar for degamer106

Let me explain what I'm supposed to do first. My assignment is to take text from a dictionary entry and display it in my client area. This dictionary entry contains characters like \ " ' and text that's written in Greek. There is an image in the upper left hand …

Member Avatar for LizR
0
127
Member Avatar for degamer106

Hi, In on of the lecture notes that was given to me by my prof, I was told that setting the ResizeRedraw value to true would allow whatever I drew on the form to be, well, resized. However, it does not seem to work. Here is my code: [CODE]using System; …

Member Avatar for LizR
0
208
Member Avatar for degamer106

When I add buttons to a panel, the buttons seem to take a huge amount of space. How do I get rid of the space? For example: [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Tester { public static void main(String[] args) { JButton dayButton = new JButton("Day"); JButton …

Member Avatar for jwenting
0
188
Member Avatar for degamer106

Ok, I looked in the API and was able to create the scroll bars. Problem is, I can't make them scroll, even though the parameters I passed in explicitly said to have the bars around. What I'm trying to do is to create a scrollpane around a JComponent object that …

0
93
Member Avatar for degamer106

Suppose I have a week that begins with Sunday and ends with Saturday (so UMTWThFS). How do I get the date for each day of the week if, lets say, we use this month and year? I looked in the API but I wasn't sure what to extract to make …

Member Avatar for masijade
0
287
Member Avatar for degamer106

I'm having a little trouble trying to nest two component classes (both extend JComponent) together. When I create the frame in my tester file, instantiate each class, and try to add both of them to the frame, it doesn't come out correctly. For instance, I want my frame to display …

Member Avatar for masijade
0
152
Member Avatar for degamer106

1) How do I tell if I have java 5 or java 6 installed? 2) I have my program commented using javadoc syntax. However, when I run javadoc from the command prompt and then open the html files, I do not see any documentation. What am I doing wrong? For …

Member Avatar for javaAddict
0
108
Member Avatar for degamer106

I'm almost finished with this program but the problem I'm having is with freeing the memory I allocated. Particularly in the area where I have pointers to strings. [CODE]#include <stdio.h> #include <string.h> #include <stdlib.h> /////////////// user defined data ///////////////////// struct State { char * name; // state name int year; …

Member Avatar for John A
0
109
Member Avatar for degamer106

The problem is that I have an ArrayList which stores objects that contain a Shape (actually a Composite shape like a Car) and (x,y) coordinates. Suppose I'm supposed to retrieve each object and the coordinates for drawing. My question is, how do I draw an Shape on the screen at …

Member Avatar for darkagn
0
108
Member Avatar for degamer106

I'm trying to put all the buttons (and their icons) into a single class. However, when I try to draw just one button in a frame, it doesn't show up. I can get it to be displayed if I instantiate the button in the same class as the Frame, but …

Member Avatar for javaAddict
0
125
Member Avatar for degamer106

I'm stuck trying to figure out how to update the text field after I click on the button in the GUI. The number of roaches is supposed to be updated each time I click, but I can't seem to find the right tool for the job in the APIs. RoachPopulation.java …

Member Avatar for javaAddict
0
126
Member Avatar for degamer106

This is a relatively simple program but for some reason, I can't compile it. I'm pretty sure the code is correct and working. My compiler keeps saying that it cannot find a constructor matching a HourlyWorker constructor when I instantiate a HourlyWorker object. I've checked and rechecked the code (in …

Member Avatar for masijade
0
191
Member Avatar for degamer106

I did a quick search on the forums and there was another problem similar to the one i'm trying to solve. I'm supposed to use the first word of a sentence as a search parameter and check the rest of the string for occurences of the word. If the word …

Member Avatar for aikem-un
0
1K
Member Avatar for degamer106

So we're supposed to modify this class, which implements Comparable, so that it accepts any type of object. The Comparable interface contains the method signature for compareTo, which I need to implement. What I'm uncertain of is how to implement this method. I know that compareTo is supposed to return …

Member Avatar for degamer106
0
91
Member Avatar for degamer106

So here's the problem [QUOTE]Write a program that asks the user to input a set of floating-point values. When the user enters a value that is not a number, give the user a second chance to enter the value. After two chances, quit reading input. Add all correctly specified values …

Member Avatar for degamer106
0
204
Member Avatar for degamer106

I'm supposed to design a method that takes in a double value and translates the value into the closest letter grade. 4,3,2,1,0 denote A, B,C,D,F, respectively. + increases a grade's numerical value by 0.3 and - decreases a grade's numerical value by 0.3. There is no F+ or F-. A+ …

Member Avatar for Member #114542
0
80
Member Avatar for degamer106

Ok, so my goal is to draw a rectangular spiral in java. So far, I've created the Spiral Viewer class and the SpiralComponent but I'm not quite sure how I would implement the SpiralGenerator class. Here's what I have: SpiralViewer: [CODE]import javax.swing.JFrame; /** Test driver for Spiral class. */ public …

Member Avatar for degamer106
0
3K
Member Avatar for degamer106

I'm trying to get this ISBN checker to work. I've used the formula from this [URL="http://mathworld.wolfram.com/ISBN.html"]site[/URL] and also this [URL="http://en.wikipedia.org/wiki/International_Standard_Book_Number"]site[/URL] and it seems to work fine [B]except[/B] for the ISBN of my Java book. When I compute my book's ISBN (0131496980), it is apparently invalid. I have tried the other …

Member Avatar for jwenting
0
191
Member Avatar for degamer106

I was a little confused by the brief explanation that my Assembly teacher gave on pipelining. I don't think I really understand the process that well... 1) In a 4-stage non-pipelined processor, how many clock cycles does it take to execute 3 instructions? Assume each stage takes 1 clock cycle. …

Member Avatar for degamer106
0
91
Member Avatar for degamer106

One of the things that's been confusing me so far is why we have to override the paintcomponent() function after extending it. For example, this program draws an ellipse: [CODE]import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; import javax.swing.JComponent; public class DrawEllipseComponent extends JComponent { public void paintComponent(Graphics g) { …

Member Avatar for Ezzaral
0
104
Member Avatar for degamer106

Hi, I need help with drawing an ellipse that is bounded by the window it is drawn in. I have to use the Ellipse2D API. Maybe I'm overlooking something but I can't seem to get the circle to fit the window. This is what i have so far: [CODE]import java.awt.Color; …

Member Avatar for Ezzaral
0
136
Member Avatar for degamer106

If I do a public inheritance and the member data in the base class I'm deriving from is protected, is the only way to access the data in the base class via member/friend functions of the derived class?

Member Avatar for John A
0
98
Member Avatar for degamer106

Hi, I can't get the following code to work. I have my converting constructor (second line) to change an int type to a car type but my compiler says there's something wrong with the overloaded + operator. It says here in my book that if I want to do an …

Member Avatar for ~s.o.s~
0
115
Member Avatar for degamer106

How do i dereference a pointer to something in a class without having to write another function to dereference it for me? For instance in this code: [CODE]class Fraction { public: Fraction(int left = 0, int right = 1); Fraction(Fraction & obj); ~Fraction() { delete fl; } double getFraction() { …

Member Avatar for thekashyap
0
87
Member Avatar for degamer106

The problem I'm having is with overloading the >> operator so that I could read data from a file directly into a class's member data. Everytime I run through the program, it just crashes. when I look through the debugger, it brings me to some page of crazy code. So …

Member Avatar for degamer106
0
129
Member Avatar for degamer106

I'm having a bit of a problem with function style cast with classes. When I exit the function I expect an instance of Database to be returned. This instance would then be copied into the db declared in main. I've writtien a copy constructor and it works fine (tested by …

Member Avatar for Ancient Dragon
0
185
Member Avatar for degamer106

This might seem like a silly question, but how do I read in a newline char, by itself, as input? For example, if I gave the user a choice to enter a string for a new filename, or let them just press ENTER for some other choice. forgot to add …

Member Avatar for WaltP
0
4K
Member Avatar for degamer106

If I have a dynimcally allocated array of objects and each of these objects contains a pointer to a string, when I use the 'delete' function to return memory, do I have to go through each array element and free each string individually or does the 'delete' take care of …

Member Avatar for Salem
0
135
Member Avatar for degamer106

So in my class we just finished covering the topic of constructors and destructors. Now, my teacher has given us a lab where we have to create these classes and each of them must have a ctor/dtor. The problem I'm running into is..well.. it would be easier to describe in …

Member Avatar for degamer106
0
383
Member Avatar for degamer106

>_< I've been searching for nearly an hour and trying to find this memory leak. If you guys could help me find it it would be great. Thx. [CODE]#include <iostream> #include <cstring> #include <crtdbg.h> using std::cout; using std::cin; using std::ios_base; /////////////// user defined data ///////////////////// /////////////// function prototypes //////////////////// class …

Member Avatar for Salem
0
208
Member Avatar for degamer106

i've been trying to use fscanf to parse parts of a line from a file. The format of each line is like the following: Connecticut,1788,Hartford,29 I've been trying to use this: [CODE]fscanf( fpIn, "%[^,], %d% [^,], %d", name, &year, cap, &popRank )[/CODE] To extract the state, year, capital, and population …

Member Avatar for Salem
0
86
Member Avatar for degamer106

I've been asked to create a movie data baseusing a hash table (w/ linked-list collision resolution) and a BST. Both of them contain a field that points a given structure (we'll call it *pMovie and its of type MOVIE) in memory. For example, if i'm going to insert "The Matrix" …

Member Avatar for Narue
0
141
Member Avatar for degamer106

I'm having trouble parsing a line with sscanf. My line is: 1941 How Green Was My Valley; John Ford and I want to separate it into a number, string, and another string. I tried: [CODE] if ( sscanf( buffer, "%d %41[^;] %51s", &pMovie->year, &pMovie->title, &pMovie->director ) == 3 )[/CODE] But …

Member Avatar for degamer106
0
100
Member Avatar for degamer106

I have the following declarations: [CODE]typedef struct{ int year; // key char title[51]; char director[41]; } MOVIE; typedef struct node{ struct node *left; MOVIE *movie; struct node *right; } TREE_NODE;[/CODE] lets say I create a TREE_NODE called root. Why can't I do this declaration? [CODE]root->movie->year = 1990[/CODE] Whenever I try …

Member Avatar for degamer106
0
107
Member Avatar for degamer106

[CODE]#include <stdio.h> struct FUN { char x; char *y; int z[20]; }; int main(void) { struct FUN fn1; struct FUN fn2; struct FUN fn3[10]; struct FUN fn4[50]; return 0; }[/CODE] is an assignment like fn4[23] = fn3[5] invalid?

Member Avatar for himanjim
0
150
Member Avatar for degamer106

One of the things I can't get working is reading and writing a structure to and from a file in binary. I'm sure that I'm using fread and fwrite correctly. However, I keep getting crashes which I cannot find ways to debug. [CODE]#include <stdio.h> #define MAX 1 typedef struct { …

Member Avatar for degamer106
0
270
Member Avatar for degamer106

Hi. I can't a small part of this program to work correctly; the square root function either returns a bunch of funny symbols OR it returns 0.00 On a side note, I have 2 questions: 1) If you have a structure nesting two other data structure types (like in my …

Member Avatar for degamer106
0
174
Member Avatar for degamer106

On a recent exam I took, the following question was given: int ***p; give the type for the each of the following: a. p b. *p c. **p d. ***p For part a, should I be given any credit for saying an "address of an address of an address?" After …

Member Avatar for ~s.o.s~
0
81
Member Avatar for degamer106

This program is supposed to make two passes through a file; the first pass counts the number of elements inside the file to get the total size; the second pass will fill the array and sort it. The problem i'm having is that on the second pass, the array is …

Member Avatar for degamer106
0
794
Member Avatar for degamer106

I'm supposed to take user input in the form of a prefix expression, convert it to infix and postfix, and then print the results. So far, I've got both working, but I would like to add some parenthesis to the infix expression once its converted. At the moment, I can't …

Member Avatar for Member #46692
0
239
Member Avatar for degamer106

OK.......right now i'm learning about binary tree traversal and this problem looks like a total killer to me. Here's it is: Write a program that takes as input the preorder and inorder traversals of a binary tree, and produces as output the level-order traversal of the tree. All i gotta …

Member Avatar for degamer106
0
275
Member Avatar for degamer106

Currently, I've been reading about Dynamic Programming in this book and I don't really see the difference between bottom-up dynamic programming and top-down dynamic programming. It seems like both of these techniques do the same thing - compute, save, and finally check to avoid needless recomputation. Any tips??

Member Avatar for Member #46692
0
94
Member Avatar for degamer106

This problem is asking me to convert an infix expression to a postfix expression using recursion. I did the exact same problem using stacks (w/o recursion), which was much easier, but on this one, I get stumped constantly when I try to come up with a line of code to …

Member Avatar for Lerner
0
342
Member Avatar for degamer106

From what I read in a few books, a static variable retains its value(s) throughout the lifetime of a program. In this stack program I've been trying to fix up, the static var doesn't seem to change or hold its contents after different function calls. I can't figure out what's …

Member Avatar for Member #46692
0
211
Member Avatar for degamer106

I'm kind of confused about how the modulus operator works. Suppose i have x % y with x > y. So if x was 6 and y was 2, then 6 % 2 would produce 0. But i don't really get what happens when x < y :eek: In this …

Member Avatar for degamer106
0
119
Member Avatar for degamer106

I wrote a program up with linked lists that creates a circular list containing 9 nodes. Each node contains a number (ranging from 1-9) as an item. My question is...in the while loops, how does [CODE]x = x->next[/CODE] cause the pointer to move across the list? [CODE]#include <stdio.h> #include <stdlib.h> …

Member Avatar for Drowzee
0
108
Member Avatar for degamer106

How do I make selection sort work with strings in a structure?? My compiler doesn't seem to like my variable assignments under the show_alpha() function. :cry: [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> #define SMAX 12 #define LEN 20 #define EMPTY 0 void show_empty_num(struct data *); void show_empty_list(struct data *); void …

Member Avatar for Micko
0
215
Member Avatar for degamer106

How do you clean out the contents of an array after you take input? In my program, I put fgets in a loop to get input. However, once I loop back to the beginning to get input for the second time, the previous input values are still in the array, …

Member Avatar for Salem
0
360
Member Avatar for degamer106

The goal of my program is to take in 2 inputs - one for the base, and one for the number (which should be of that base type). It will then do a calculation and print out the number in base 10 form. For instance, Input Output ========== ====== 10 …

Member Avatar for degamer106
0
103

The End.