32,204 Topics
| |
The above code computes the value of a mathematical expression supplied at command line by using the concept of converting infix to postfix,then evaluating the postfix expression. Any comments are appreciated. | |
Here's a simple thing that I can't find a simple solution for - so any suggestions will be very welcome... I have a `Map<String, MyClass>` and if it has more than 1 entry I let the user pick a MyClass instance by displaying the keys. No problem there. If it … | |
hello i want to stop the music after pressing other song i tryed much different ways of doing it but no results please anyone help me i have this code ... package passwordsaver1; import java.awt.Dimension; import java.awt.Toolkit; import java.net.URL; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.JOptionPane; /** * * … | |
Hello generous java coders!I am really in a desperate situation now. I have a working gui code here: import java.awt.event.*; import java.awt.*; import javax.swing.*; public class CountdownTimer extends JFrame { JLabel promptLabel, timerLabel; int counter; JTextField tf; JButton button; Timer timer; public CountdownTimer() { setLayout(new GridLayout(2, 2, 5, 5)); promptLabel … | |
| |
basically i am working on a project for uni, which is to create a form of an abacus model. - peg_array[] stores the number of counters/beads present in each of the pegs(lines) of the abacus. i am trying to use 2 boolean methods: "boolean removeCounter(int thisPeg)" "boolean removeCounter(int thisPeg)" thisPeg … | |
Hi I am trying to write a binary search function to search for a specific character in a character array sorted in ascending order. Whenever I run the code though nothing happens, there are no errors or anything, just nothing happpens until I terminate the program myself. Below is my … | |
Hello, well this suddenly surprised me .. dunno why ... i was trying to solve the binary-tree implementation ... where i noticed using root.left = new node bla bla My question insert(Node root,int value) root.left = new node(null null value) Etc ... The function doesnt create a copy of the … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Burger extends JFrame implements ActionListener { JLabel lblForAll, lblBelow, pic, pic1, pic2, pic3, pic4, pic5, pic6, pic7; JRadioButton rBtn, rBtn1, rBtn2, rBtn3; JCheckBox cBtn, cBtn1, cBtn2, cBtn3; JTextField txt, txt1, txt2, txt3, txt4, txt5; JButton btn1, btn2; ButtonGroup btnG; int ham=25, egg=15, … | |
can i change toggle button's state to another (play state to pause),by clicking another button(stop) | |
any one help me???????????????????????????????? how to convert text file to kml file using java??? | |
Hi, i'm making a java program, and I started making the gui with a `JTextArea`, and tried to add a font (`Consolas`) and It crashes with a "divide by 0" error. It works fine on windows, and if you comment out the `setFont` line.. import javax.swing.*; import java.awt.Color; import java.awt.Font; … | |
Please help me. It goes like this: Write a program that will determine the income of an employee. An employee is either a part-time or a full-time employee. A part time employee's gross income is computed as the product of his/her hourly rate and the number of hours worked. The … | |
My homework goes like this: Write a program that accepts as many integers the user wants to input. Determine the highest and lowest numbers and subtract all other numbers from the highest number. example: numbers to be entered: 6 number1 :15 number2:20 number3:29 number4:38 number5:12 number6: 42 Output: Highest: 42 … | |
I need to write a code with a constructor class in order to see the whole phonelist using an array that reads from a document txt, able to add a person and phone number, search just one person in the phonelist and able to modify their phone number. here is … | |
I need to input a name in the JMenuItem(employee name) using JOptionPane, I used this statement (JOptionPane.showInputDialog(frame, "Enter Employee Name");) and I try using a string variable but nothings happen. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.FlowLayout; import java.text.MessageFormat; import javax.swing.table.AbstractTableModel; public class Cs extends JFrame implements ActionListener { … | |
I am having a problem to understand how class inhertance works in Java.. Now I want to get information from a class to another and let's say we have class A and class B class A contains a string an int and a byte class B contains a String and … | |
I was just wondering if someone could maybe set me on the right track or tell me exactly how to do what I am about to ask. I have a bunch of answers in a notepad file, such as TFTABCD (going downwards, a letter per line), how can I make … | |
public class W4P7{ public static void main(String []args){ int [] myArray = {11, 29, 21, 23, 33, 32}; method(myArray); }//end of main /****************start of method****************/ public static void method(int [] x) { int swap; for(int i=0; i<x.length;i++){ for(int j=0; j<x.length-1;j++){ if(x[j] > x[j+1]){ swap = x[j]; x[j]=x[j+1]; x[j+1]=swap; }//end of … | |
I am trying to read a random line from a file and if that line is null it will create a random string. It works with files with upto and including 5 lines. To test it I made a 2 line file: > 1-hello > 2-but However, when run it … | |
in an assingment, i have to implement a deque ( double ended queue ). the underlying datastructure is allowed to be arrays or linkedlist. only that im not allowed to use any prebuilt java api that does the above. (like the java.util.LinkedList api) implementing the above using doubly linked list … | |
Loop trough a HashMap <String, Integer> and if the value is something, for example, 5, then put the key in an array. I'm not sure where to start, I'm having trouble on the "Loop trough a **hashmap**" part. Thank you. | |
Hey Guys, I'm want to output a calculation to a JLabel. Example: double num1 = 14; double num2 = 3; double ans; ans = num1/num2; JLabel jl = new JLabel(); add(jl); jl.setText("The Answer is: " + ans); Currently the answer for this will be 4.666666667. Now if this was a … | |
Hi Guys, I am creating a system to work on a database adding updating etc. And the combo boxes are giving me trouble. The process is as follows. The user searches for a business by location once entered all business for that area are then displayed name address owner etc. … | |
Hello I am trying to insert some data into a sql server i have but it seems like I'm formating the information wrong. This is what i have so far. product id = int; type = string; watt = float; volts = float; String query = "INSERT INTO GoodCustomer(Product ID, … | |
Please am new to java and i need an assistant on loading hexadecimal from a textfile and converting it into binary(Loader class) then the binary will be kept in another class(memory class). then the binary will be forwarded to another output file. | |
please help me to explain the two dimentionalsales about sales person: 1. while 2. do- while 3. if 4. if-else 5. for | |
Hi everyone. I am currently doing small exercises on classes. Suppose you have 2 classes: Person (superclass) and Student (subclass) the class Student is extending the class Person. When creating new objects of type Student, when do use the following options: option 1: student x= new student( ..); option 2;( … | |
The problem with my code is that the update method doesn't get invoked even after I notify the observers. Did I miss something in my code? package com.observer3; import java.awt.FlowLayout; import java.util.Observable; import java.util.Observer; import javax.swing.JLabel; import javax.swing.JPanel; public class A extends JPanel implements Observer{ JLabel lbl; public A(){ setLayout(new … | |
Hey guys, can anyone tell me how I could use randomaccessfile to read in a txt file and copy the content to a tree? Also how to then do the opposite and write newly changed nodes from the tree onto the text file? It's pretty much like creating a save … |
The End.