32,204 Topics
| |
I am trying to implement huffman coding scheme in java.But I am facing problems in building the huffman tree.How to proceed ?Is there any datastructure in java that will help me to do it?Please help!! | |
Here's the code: [CODE]class SingleBoard extends JPanel { public SingleBoard (ActionListener e) { setLayout (new GridLayout (3, 3)); for (int i = 0 ; i <= 8 ; i++) { buttons [i] = new JButton (); buttons [i].addActionListener (e); add (buttons [i]); } } } public void init () { … | |
[B]In the Code below i have a program using multi dimensional arrays. I have a quick question on "How to" ad a checking system so my random class does not generate the same "type" of horse twice. For instance right now i have my program pick a random color with … | |
Hey Lets see if I can explain myself correctly...... I have 2 projects, one a program and another a library. First project is basically this, more or less (obviously it is more complicated) [code] //This is the main project //Inside com.stuct: //Global.java package com.stuct; public class Global { public static … | |
[B]For some reason whenever i print out the code below "System.out.println("Heat 1:"); never prints but rather somehow just leaves the terminal window. because when i use print instead of println it shows but not when i use println[/B] [CODE] System.out.println("Heat 1:"); System.out.println(heat1[0][0] +"\n"+ heat1[1][0] +"\n"+ heat1[2][0] +"\n"+ heat1[3][0] +"\n"+ heat1[4][0]+"\n"); … | |
i am newbie to java.i am trying to run a program to show "static method" and "static variable ".my code is below.i am compling it on netbeans 7.01 and everytime i am getting the error.: "main method not found in class static_demo.Static_demo, please define the main method as: public static … | |
I am working on a nested control structure program that will, when user imputs any letter, whether it be upper or lower case will count the number of times the letter appears in the sentence entered by the user. In the code below when the user enters lower case letter … | |
well I'm trying [CODE] String filename = "table.file"; JTable table = new JTable(elements, header); TableModel tm = table.getModel(); try { FileOutputStream fos = new FileOutputStream(filename); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(tm); oos.flush(); oos.close(); } catch (IOException e) { e.printStackTrace(); return; }[/CODE] but it only delete the old entry and write … | |
Hey guys!!! I know these simulations are too much but.... still another one and I am havin some problems with that/// I have to create a file system simulation that has to understand these commands: cr a - create a new file named a, size ==0; rm a - remove … | |
Can someone please help me find what is wrong with my code below. The program is suppose to add all the input numbers except for the sentinel which is -1. What am i doing wrong? import java.util.*; public class InClassWork { static Scanner console = new Scanner(System.in); public static void … | |
hello every body, how are you all please i want some one to help me in my prgram this ,as i think, is the piece where the problem occur, the output is being to give only the last value i enter from the keboard where me need is to insert … | |
whats the error in here? everytime i run this program even though there are no red underlines and signs still, it say theres an error in here ... and how can i do the same program using if else statement? i have started doing if else but my program its … | |
Hi, I am creating a tool where a user takes a screen shot of the users report and paste all in a word document. I am working on a tool which automates this, im my application the user click snapShot button on the screen where the snapshot is to taken, … | |
I have create a JFrame for my Login Screen. I need my JFrame to be Non Draggable. I tried the setUndecorated method. It makes the Jframe Non-Draggable. But I am not able to view the border of the Jframe and also the minimise, close buttons. So what is the alternative … | |
Hey. I am trying to make a "virus" that will not let the user exit the program even with pressing Command+Q (oh, ya, I have an Apple). Here is what I have so far: if (keylistener.getKeyCode()==81){ System.out.println("Works"); } I have the println just to see if it works (which it … | |
My objective is actually [B]extremely[/B] simple, but I just don't know how to do it. I want to put some swing components on top of graphics which fills the entire screen. That's it. And I can't figure out how to do it... Some other side-questions that I would love to … | |
i have Register page and Login page.And for save usernames and passwords i used arraylists in a servlet.how can i forward these arraylists to another servlet for validate username and passwords..? | |
So i have a problem that reads: Each line of the file consists of a student’s name followed by an unpredictable number of test scores. The number of students is also unpredictable. The desired output is as shown where the numbers there represent the average test score rounded to the … | |
I have configuration properties implemented as a java.util.Properties Object with the mappings saved in a config.properties file. I have managed to update the properties in a user input panel, so the user can change any settings while the application is live. However I want any changes a user makes to … | |
Hello, I am a student.For the project we have to store first 20 search engine results (URLS and id) in the Mysql database.We referred to the google search API ,it says we will get results in JSOn/ATOM format.But we are not getting exactly how to store those results in JSON … | |
if u will try to run this, while looking at the codes ull know my mistake, the thing here is when i choose "b" it will show the balance, the a question like this will open up: "Would you like to generate bank slip?" if yes it should go in … | |
[CODE] public static Integer[] getTopThree(Integer[] values) { int max1 = Integer.MIN_VALUE; int max2 = Integer.MIN_VALUE; int max3 = Integer.MIN_VALUE; //assuming integer elements in the array for (int i = 0; i < values.length; i++) { if (values[i] > max1) { max3 = max2; max2 = max1; max1 = values[i]; } … | |
Good afternoon Well my idea is simple.What i want to do is to create a currency converter.Pretty easy task, but i want the currency rate to be updated somehow by an external server, probably from an website.Although i have experience in programming i have no clue how to use an … | |
[CODE] for (ctr = 0; ctr<cost.length; ctr++) { cost[ctr] = price[ctr] * qty[ctr]; totalCost = totalCost + cost[ctr]; aveCost = totalCost / cost.length; } System.out.printf("Average Cost: %.2f\n\n", aveCost); [/CODE] with this code the output will be, for example: [QUOTE]Average Cost: 15900.00[/QUOTE] I want my output to look like this [QUOTE]Average … | |
I'm suppose to follow this algorithm: 1. Declare all ordinary Variables 2. Prepare and initialize all arrays. 3. Prepare array to hold all item cost. 4. Initialize Array cost with 0.(using for()statement) 5. Compute cost of each item then store results to array cost.(using for()statement) 6. compute average cost(using for()statement) … | |
Actually i try to create a method which can call the scanner keyboard firstly i was trying this void makeRequest(){ request ="Hello"; } So i wanna make like when i call this method it will tell me to input the String by scanning the keyboard is it possible to do … | |
why is that some of the codes that i put in are not being implemented when i run this?? i mea, the cycle of my program doesnt seem to be flowing the way i want it to be, come take a look :( [CODE] { /** * @param args */ … | |
I can't figure out what the error is. [CODE]public void quizTest () { c = new Console(); int total = 34; String[] quizArray = new String [total]; String quizQuestions; int i = 0; int u = 0; try { FileReader readQuestion = new FileReader ("QuizQuestions1.txt"); BufferedReader buffReadQuestion = new BufferedReader … | |
i dont know that my error is, my code for balance is not working properly and im having a problem with my if else statements, they say i lack this "{" but i dont know where to put it [CODE] { /** * @param args */ public static void main(String[] … | |
Are there like 3d pushable buttons in Java? I want to put 3 buttons on top of each other, is that posible? I found JButton and I don't think I can do it with that? |
The End.