Tagged Questions
1
vote
1answer
64 views
High School Java Class: Pong Project External Reviewer
Panelball class:
import java.awt.*;
import java.awt.event.KeyEvent;
import javax.swing.*;
public class Panelball extends JPanel implements Runnable {
private static final long ...
1
vote
1answer
50 views
Help creating a workable design?
I received the following feedback for my code:
"I still do not see a design here that will work.
It is a very bad idea to have the big switch and loop at this point. All you need in your main() ...
0
votes
1answer
43 views
2D Array: Retrieve the “Left” Item
I am creating a game that contains a Board and Pieces. The Board is basically a 2D array of Pieces. [Think smaller chess board]
One of the things that I want to accomplish is to be able to retrieve ...
2
votes
2answers
127 views
Calculating and displaying number statistics
I'm writing a program which takes individual int inputs from the user and then outputs some details on the numbers (average, min, max and how many).
Input.readInt() is a method I made which simply ...
3
votes
1answer
44 views
Code to find the proper index comparing 3 values for max one
I have an algorithm and the idea is to move over an array choosing as index the index of the neighboring cell that has the max value.
I.e.
if array[i + 1][j + 1] has the largest value among the 3 ...
2
votes
1answer
191 views
Ranking and sorting on Array/List
My apology, I am quite new to posting a question in this forum.
I had a task where I was supposed to write a solution to sort entries(Name, score - in an array/list) in order of score and generate ...
1
vote
0answers
166 views
App engine Java: Sum difference two arrays - How to improve performance?
I have a function in App Engine java where I compare two patterns stored in an int array.
Below is the code:
public static int patternMatch(int [] pattern1, int [] pattern2, int range) {
int ...
0
votes
1answer
63 views
help review array of object code [closed]
public class DoubleMatrix
{
private double[][] doubMatrix;
public DoubleMatrix(int row, int col)
{
if(row > 0 && col > 0)
{
makeDoubMatrix(row,col);
}
...
1
vote
2answers
63 views
Request for help to tidy up code involving arrays and loops
I posted the following code on here a few days ago:
public class Practical4_Assessed
{
public static void main(String[] args)
{
Random numberGenerator = new Random();
int[] ...
0
votes
2answers
72 views
add Matrix method review
package homework3;
public class DoubleMatrix
{
private double[][] doubMatrix;
public DoubleMatrix()
{
int row;
int col;
if(row > 0 && col > 0)
...
4
votes
1answer
162 views
Partitioning Array
Problem: Given a randomly ordered array of n-elements, partition the
elements into two subsets such that elements <=x are in one subset and
elements > x are in the other subset.
one way to do this ...
4
votes
3answers
111 views
Is my code dealing with the presented problem the right way?
I finished this program to print a 2D array, I got the right output, but I'm not sure if I did what was being asked in the problem below.
My code to deal with the presented problem:
package ...
4
votes
3answers
413 views
A simple array-based Stack class in Java, what are my mistakes?
I have created a simple array-based Stack class with some methods like the actual Stack in Java.
I am testing this for mistakes, but since I am learning Java and my tests may not be as comprehensive ...
4
votes
2answers
304 views
A simple ArrayList class in Java, what are my mistakes?
I have created a simple ArrayList with some methods from the actual ArrayList in Java.
I am testing this for mistakes, but I am learning Java and my tests maybe are not comprehensive. So I decided to ...
0
votes
1answer
183 views
Am I doing this right? Merging 2 ordered source arrays into one destination array
My instructions were:
Add a merge() method to the OrdArray class in the orderedArray.java
program (Listing 2.4) so that you can merge two ordered source arrays
into an ordered destination ...