I have to implement all the stack methods in java such as push, pop empty, not using the ready methods but have to create them and to execute an exercise but something wrong with it....
public class Stiva {
/** the problem is here how to declare the stack 1 and stack 2 and kreu(head) gjmax(size)*/
int Gjmax;
int array[] = new int[Gjmax];
int kreu;
private Stiva stiva1;
private Stiva stiva2;
I have to implement all the stack methods in java such as push, pop empty, not using the ready methods but have to create them and to execute an exercise but is sth wrong with it
public class Stiva { /** the problem is here how to declare the stack 1 and stack 2 and kreu(head) gjmax(size)*/ int Gjmax; int array[] = new int[Gjmax]; int kreu; private Stiva stiva1; private Stiva stiva2;
I have to implement all the stack methods in java such as push, pop empty, not using the ready methods but have to create them and to execute an exercise but is sth wrong with it
public class Stiva {
/** the problem is here how to declare the stack 1 and stack 2 and kreu(head) gjmax(size)*/
int Gjmax; int array[] = new int[Gjmax]; int kreu; private Stiva stiva1; private Stiva stiva2;
So I have this stack. I'm writing out all the operations and what not but I'm having trouble bypassing this "generic array creation" problem. I'm meant to be creating an array based implementation of a stack and from my research from google and my various attempts at things, I have not found a solution that works.
In addition; I have all the operations written that I need except for one final one. And that is clear(). clear() is meant to empty the array, essentially it is a popAll() method. Then all I need to do is set up so I can print out the arrays and I should be able to handle everything else.
StackInterface:
/** An interface for the ADT stack. */ public interface StackInterface<T> { /** Adds a new entry to the top of this stack. @param newEntry an object to be added to the stack */ public void push(T newEntry);
/** Removes and returns this stackÕs top entry. @return either the object at the top of the stack or, if the stack is empty before the operation, null */ public T pop();
Not necessarily Java related, more a general programming issue I have come a long and I am currently using java to mock up a project that will eventually get moved over to C++.
I am trying to implement FFT Convolution into a java project and have things partially working, I do not know if it is a coding issue, logic issue or if I simply know nothing of FFT and convolution.
For starters I got an FFT library that I do have working, if I create a small array pass it into the forward FFT, do a little bit of bit manipulation (converting a complex array of size n*2 into a re[] and im[] of size n), run the inverse FFT and do the same bit manipulation again I get back where I started.
However if I take two arrays, a Dirac Delta function (an array with a 1 followed by zeros for the rest of the array) and a stepping kernel (ex. {1, 2, 3, 4 etc}), I would expect to get the forward FFT of both arrays, bit manipulation, multiply them together, Inverse FFT, and bit manipulate again and the result would be the kernel. I have not had such luck.
This is the gist of the program:
// bit manipulation, converts complex array to two re and im arrays public void bitTwiddle(double [] real, double [] real2, double [] imaginary){
for (int idx = 0; idx < (N * 2); idx++){ realCopy[idx] = real [idx];
[Code] ....
This is the result:
Quote ===================================================================== Dirac Delta In Time Domain: Real:1.000.000.000.00 Imag:0.000.000.000.00 ===================================================================== Dirac Delta Frequency Domain Real:0.500.500.500.50 Imag:0.000.000.000.00 ===================================================================== Kernel In Time Domain Real:1.002.003.004.00 Imag:0.000.000.000.00 ===================================================================== Kernel In Frequency Domain Real:5.00-1.00-1.00-1.00 Imag:0.00-1.000.001.00 ===================================================================== Result: Dirac Delta x Kernel Real:2.50-0.50-0.50-0.50 Imag:0.00-0.000.000.00 ===================================================================== Result In Time Domain Real:0.501.501.501.50 Imag:0.000.000.00-0.00
What would be the most effective method to display data grabbed from a web source that is queried every second, for example the most recent EUR/USD price?
I already have access to the data stream, and I've built a simple FXML in javaFX that contains a grid; I'm not sure how to approach putting the live ticking data into the grid so it continues to update as the price changes, for example.
I want to use graphs in java. Is there any class in java for implementation of graph theory? I most create a graph and run DFS(Depth First Search) algorithm on that.
My assignment is to design a simple GUI calculator using the stack data structure to perform additions, subtractions, multiplications and divisions. But i having error while i press the action there.
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.util.Stack; public class JCalculator implements ActionListener {
I have an error using quicksort and this is a project ... The error occurs for numbers such as 7500 and bigger ...
Exception in thread "main" java.lang.StackOverflowError at QuickSort.QuickSort(QuickSort.java:45) at QuickSort.QuickSort(QuickSort.java:46) at QuickSort.QuickSort(QuickSort.java:46) ...
Java Code:
import javax.swing.JOptionPane; public class QuickSort{ public static void main(String[] args){ int p=new Integer(JOptionPane.showInputDialog("Jepni numrin e kufizave: ")); int[] ListaNumrave= new int[p]; //QuickSort Zbrites
I am trying to figure out stacks and queues and was trying to get this Palindrome program working so I could then play with it and use the Java visualizer site but for some reason the program isn't working correctly. It always states that the input is a palindrome no matter what the user input is.
The book that I got the code from is a little old so I changed a couple small things that I thought needed updating like adding scanner. I wanna use one with a custom array based stack and queue class rather than the java.util.Stack and Queue interface, just for understanding stacks and queues better hopefully.
import java.util.Scanner; import javax.imageio.IIOException; public class PalTest { public static void main(String[]args) throws IIOException { Scanner scan = new Scanner(System.in); PalindromeTesting x = new PalindromeTesting();
In Main.java, How can i call method in CircleCalculationMethod.java ?
Should I put everything in same folder ??Should i do something like "import CircleCalculationMethod.java"Should i do something like create a package ...
public class HelloWorld { public static void main(String[] args) { String firstLine; String startUp; int hour, minute;
[code]...
Every time I try to run this is eclipse, I only get the first part, so it reads in the console: "Hello, world. The time is now 9:15. I'm tired."I want it to read: "Hello, world. The time is now 9:15. I'm tired. (new line) Today is Wednesday."
1. Modify the following class so that the two instance variables are private, there is a constructor that accepts both the player's name and sport and there are get and a set methods for each instance variable:
public class Player { String name; String sport; }
2. You can pass an instance of this class to the JLabel constructor if you want to display text in the label.Select one: a. myLabel b. myText c. String d. JTextField e. JLabelText
how to start making this work?cause i am not familiar with the terms here and want to complete this program and I am new to java programming?
I was doing a project in a usual Java Application, but now maybe I have to use some tools that are contained in javafx.scene.media.MediaPlayer so I wonder if can it all work? Will javafx methods and such works?
I have to use javafx.scene.media.MediaPlayer beacuse I have to create a very simple audio player (one jbutton and one jcombobox).
I am trying to make a 2d graphical animation using the java swing classes in order to make a frame. I had a basic version working when all of the code was under the main method, but when I moved some into another method it broke it. With y understanding of java my code should work as I create a variable of the method containing the code and then assign the size and exit button. However this causes many problems such as my BeaconFrame method informing me that it is unused when I have used it. Here is my code:
import javax.swing.*; import java.awt.*; public class BelishaBeacon { public void BeaconFrame() { JFrame frame = new JFrame(); JPanel panel1 = new JPanel();