35,620 Topics

Member Avatar for
Member Avatar for iTechnnn

This is my assaigment: Let's say that we can buy a candy from the vending machine for $1 each. Inside every candy is a coupon. We can redeem six coupons for one candy from the machine. This means that once you have started buying candy from the machine, you always …

Member Avatar for iTechnnn
0
169
Member Avatar for nikolaos

Using NetBeans 7.3.1 i have created a JFrame. A JLabel fills the bottom of the JFrame . The JLabel displays an ImageIcon. I want the ImageIcon automatically resize itself when JLabel resizes. Generated Code from IDE : jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Number_theory/resources/primes_ulam_spiral.gif"))); // NOI18N jLabel1.setDoubleBuffered(true); jLabel1.setOpaque(true); jLabel1.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent …

Member Avatar for JamesCherrill
0
692
Member Avatar for benjo.s.lucas

I have this code that if i enter a number for example : Enter a number: 1 2 3 output is Even:2 Odd:1 Odd:3 but i like it like this: Enter a number: 1 2 3 Even: 2 Odd : 1 3 Here is My code hope you could help …

Member Avatar for benjo.s.lucas
0
123
Member Avatar for Madiya122

Hi all, I have just started to learn java. The trial code I have is showing errors at compiling. Here is the code. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.Scanner; public class ppp { public static void main(String args[]) throws FileNotFoundException { //Scanner Example - read file line by line in …

Member Avatar for Madiya122
0
509
Member Avatar for Benjamin_4

i want to calculate the depreciation of an asset and i want my accumulated value to automatically add the previous monthly depreciation value with the current one any time the user calculates for the monthly depreciation, the accumulated value should pick the results from monthly depreciation and add it to …

Member Avatar for cereal
0
2K
Member Avatar for ahmed.talha.16

Hello! can anybody please tell me the formula through which i can make the prime number program. I couldn't found the logic of it.

Member Avatar for uttkarshsing
-1
345
Member Avatar for techxaidz

Hi! I am beginner in Java Programming and I am currently working with a program that randomly populate 14 buttons with a letter based on a given set of words and if the size of the word is less than the size of the button, it'll just populate it with …

Member Avatar for techxaidz
0
326
Member Avatar for Benjamin_4

I want to populate my jtable with columns from different table in mysql database but it only displays the column names and not the data or information under those columns. i hope this code helps u undertand what i mean. thanks private void Update_table(){ try{ String sql = "select Date_Acquired …

Member Avatar for JamesCherrill
0
213
Member Avatar for ahmed.talha.16

Hello! Im new to the java. During creating a program Im getting a warning "@suppresswarnings( deprecation )". I wants to know why is that warning occur and how to avoid it.

Member Avatar for jwenting
0
318
Member Avatar for Smith6969

Im trying to take an amount of change, less than $1.00, but more than zero and display the number of quarters, dimes, nickels, and pennies that will be required to make that change. The output must be presented in a descriptive manner that resembles the English language with the following …

Member Avatar for JamesCherrill
0
188
Member Avatar for dancingdophie

So I'm writing an event-driven program. The program is supposed to calculate checks and deposits, but the calculation comes out completely wrong. For instance, if i type 500 for initial balance, click 'entering a transaction', type 1 for checks, and type the amount 50 for transaction amount, the remaining balance …

Member Avatar for javanoobcoder
0
272
Member Avatar for aminem2080
Member Avatar for JamesCherrill
0
27
Member Avatar for Kuroshi

public static void removeEvensVer1( List<Integer> lst ) { int i = 0; while( i < lst.size( ) ) if( lst.get( i ) % 2 == 0 ) lst.remove( i ); else i++; } According to my understanding, shouldn't this method be N^3? Since you have a while loop (N) * …

Member Avatar for JamesCherrill
0
83
Member Avatar for gtsiga

Hie guys everytime I open uninstalled netbeans 7.3 and installed 7.3.1 but my projects which require javax.microedition.* are nolonger running. How can I add the package on the nebeans such that I don't have to refence them on each and every project. Thanks in advance

0
89
Member Avatar for vivosmith

import java.awt.Point; import javax.swing.*; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPanel; public class painttest extends JPanel { private int pointCount = 0; private Point[] points = new Point[1000]; public painttest(){ addMouseMotionListener(new MouseMotionAdapter() {public void MouseDragged(MouseEvent event){ if(pointCount<points.length) {points[ pointCount ] = event.getPoint(); // find point ++pointCount; // increment number …

Member Avatar for mKorbel
0
372
Member Avatar for woochoi24

I have to convert it to using for loop from while loop. I don't know how to start with it :/ import java.util.Random; //to use the random number generator public class DiceSimulation { public static void main(String[] args) { final int NUMBER = 10000; //the number of times to roll …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Benjamin_4

Please how can i insert into two different tables in mysql using java. i tried this and its only for one table. so how can i insert into branches and items table simultaneously in the same code? try{ String sql = "Insert into asset_update (Date_Acquired,Item_Code,Serial_Number,Cost_Of_Acquisition,Estimated_Useful_Life,Depreciation_Start_Date,User,Status,Disposal_Date)values (?,?,?,?,?,?,?,?,?)"; pst=conn.prepareStatement(sql); pst.setString(1, ((JTextField)date_aquired.getDateEditor().getUiComponent()).getText()); String …

Member Avatar for Benjamin_4
0
3K
Member Avatar for SAM2012
Member Avatar for masijade
0
92
Member Avatar for munchlaxxx

I'm trying to make a Palindrome program and this loop is giving me trouble: for (int i= 0; i < 79; i++) { character[i] = scan.next(); if (character[i] == ".") {break; } } The user enters a word, and when they are done, they enter a period, which is supposed …

Member Avatar for jwenting
0
289
Member Avatar for jmartzr1

Hey everyone, I'm doing a practice problem and I'm stuck. The question is "Given an array a of n numbers (say doubles), consider the problem of computing the average of the first i numbers, for i ranging from 0 to n-1. That is, compute the array b of length n, …

Member Avatar for JamesCherrill
0
235
Member Avatar for djslavens

Hi there! I am new to the Daniwewb forum, and I was wondering if there was a forum or section specifically dedicated to promotions of books, ebooks, and articles on Java Programming. If you could please send me a link to get me pointed in the right direction or just …

Member Avatar for JamesCherrill
0
68
Member Avatar for Seswing142

Our program must create a guessing game that asks the user what the range they want to game to be and how many guesses they want. Once that is done it askes the user to make a guess and based on the guess its supposed to say Hot if it …

Member Avatar for stultuske
0
514
Member Avatar for RaigaX9

Hello everyone, I'm having some issues with my rock, paper, scissors JApplet program. Of course I have it "extends Applets" from the beginning of my class and I realized that this wasn't the same as JApplet. After I changed "Applet" to "JApplet", when I ran it, it doesn't look like …

Member Avatar for mic0280
0
577
Member Avatar for Nawaf15

Hi, I am trying to write an application that will calculate the volume of a pool with fixed length and width. The user will be prompted to enter 2 values for depth. The application should draw a cross-section of the pool using length, deep end and shallow end. A part …

Member Avatar for JamesCherrill
0
183
Member Avatar for qwerty14444444

pls help me with my codes, age doesn't appear on the text file and i got end of file error when i click "view" button. can someone kind enough to fix this..god bless and more power =) my code >>>>>> http://www.2shared.com/file/8whfrcUJ/Frame1.html

Member Avatar for JamesCherrill
0
292
Member Avatar for cakka

Hello, I got this question from my quiz : > Consider the following code (assume that comments are replaced with real code that works as specified): public class TestExceptions { static void e() { // Might cause any of the following unchecked exceptions to be // thrown: // Ex1, Ex2, …

Member Avatar for JamesCherrill
0
307
Member Avatar for lena1990

hi all i want to create a program that each thread will be handle a part of the log file and read from it at the same time ?? Thanks in advance

Member Avatar for lena1990
0
132
Member Avatar for kay19

Hello. Nearly finish this project, but can't sort the last code. I have faculty, staff, & partime employees, and they have ID, and what I want to do is sort by ascending order them based on their #ID. Everything else works before that. Here is my two codes, the Tester, …

Member Avatar for kay19
0
161
Member Avatar for TheAustinG

For my beginner Java class I am writing a program that will read data from inData.txt and write output to the file outData.txt. I have 5 errors that all say a symbol cannot be found but I'm not sure what exactly it's talking about or what is wrong. The error: …

Member Avatar for TheAustinG
0
340
Member Avatar for murali2489

Hi All, I have completed learning core Java and I want to move to next level in Java Study. I am really confused on what topic to cover next in JAVA . And I also don't know what are all the major topics in JAVA to study after Core Java. …

Member Avatar for murali2489
0
212
Member Avatar for thewayoftheduck

**Question** You are to design and implement a GUI application that will calculate the price of a pizza, based upon the size, style of crust, and selection of toppings. The price is calculated according to the following rules: • A plain small pizza is $6, medium is $8, large is …

Member Avatar for jwenting
0
3K
Member Avatar for F_1

// CS 1063 Project 1: Print Text Patterns The Patterns Class Objectives This is one of three major programming projects this semester. You may NOT collaborate on this project. While you may ask for assistance in debugging, this project should be ENTIRELY your own work. [EDITED BY ADMIN ON COPYRIGHT …

Member Avatar for jwenting
-2
319
Member Avatar for Fatima_110

This code is supposed to determine for a number of random numbers whether its odd, even , prime. At the end all random numbers should be displayed and the prime ones together with the number of odd and even numbers and their %. The part of the code to determine …

Member Avatar for jwenting
0
303
Member Avatar for N841990

how do we use barcode scanner scanned data in our java program .is there any class which can help me.

Member Avatar for straw77berry
0
473
Member Avatar for AndroidUser

Hello, My objective is to create a text file in an android file system. I have looked into the appropriate packages and methods for creating a file. But I am still looking for information about how to access the internal directory structure in order to create a file on an …

0
63
Member Avatar for Aarowaim

Hello everyone, I'm an amateur programmer, and I am working on a program to help me practice my mental math. The essence of this program is that the user inputs an expression which will be the form of each question. Their goal is to solve those expressions as fast as …

Member Avatar for gusano79
0
260
Member Avatar for lena1990

hi all i want to create a pie chart but i get an excepion i will print the code and the exception i will be greatful for any help DefaultPieDataset pie1=new DefaultPieDataset(); pie1.setValue("Section 1", 46); pie1.setValue("Section 2", 56); pie1.setValue("Section 3", 43); pie1.setValue("Section 4", 11); JFreeChart chart=ChartFactory.createPieChart("Log ID chart", pie1, true, …

Member Avatar for lena1990
0
339
Member Avatar for wallet123

Hello! i need to filter the searched data in the database sql and display it on the table. But i keep on getting tis error: java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(Unknown Source) at app.SearchByKey.SearchStudentNumber.SearchStudentRecordReader(SearchStudentNumber.java:38) at app.ui.ListOfStudents.updateSearchTable(ListOfStudents.java:159) at app.ui.ListOfStudents$3.keyReleased(ListOfStudents.java:105) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) …

Member Avatar for JamesCherrill
0
433
Member Avatar for java_programmer

I have a question - how mwmory is allocated when any data structure is declared? Suppose I have declared a list as follows - List<Integer> lst = new ArrayList<Integer>(); How many bytes will be allocated for that variable or initially no memory will be allocated? Memory will be allocated when …

Member Avatar for jessicarobort
0
248
Member Avatar for faisal6621

I want to work on an antivirus software program. But, what should I know first to dig?

Member Avatar for JamesCherrill
0
742
Member Avatar for abinmathews

hey i want to create two *buttons* namely** submit** and **update** button in one page,but i need to knw wheather both the actions of the button can be performed in the same page or in diffrent page,if it is to be performed in diffrent page,how do i do it??

Member Avatar for stultuske
0
271
Member Avatar for iTechnnn

My assaigment was: Suppose we are working for an online service that provides a bulletin board for its users. We would like to give our users the option of filtering out profanity. Suppose we consider the words cat, dog and llama to be profane. Write a program that reads a …

Member Avatar for masijade
0
518
Member Avatar for dharmatej.m

Write Java program that generates the Fibonacci sequence in the child process. The number of the sequence will be provided in the command line. For example if 10 is provided, the fibonacci numbers less than 10 will be output by the child process. Because the parent and the child processes …

Member Avatar for stultuske
-1
230
Member Avatar for Petranilla

Hi, Having some issues connecting to MS Access Database. I think its ot connecting to the database. Below are the source codes: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DB extends DBDriver implements ActionListener { JFrame f; JLabel Fname = new JLabel("First Name: "); JLabel Lname = new JLabel("Last …

Member Avatar for Petranilla
0
346
Member Avatar for Louie_Rave

Hello everyone. I'm currently exploring Java's GUI and trying a lot of codes now. I found a game GUI source code on the net. This program uses images to properly run. I can run the program now but it only displays black screen. It already have the folder for the …

Member Avatar for Louie_Rave
0
256
Member Avatar for mitalawachat

I want to develop **JavaFX/Java AUTOMATIC CODE GENERATOR**. I need algorithm or sample program. If anyone can help please mail solution to <snip> *DaniWeb Rules include: Do not ask anyone (member or moderator) for help by email or private message*

Member Avatar for stultuske
-1
45
Member Avatar for kylealb007

package guessinggame; import java.awt.FlowLayout; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; //create class GuessingGame that extends to JFrame public class GuessingGame extends JFrame { public static void main(String args[]) { //define variables private JLabel instruction1JLabel; private JLabel instruction2JLabel; private JLabel instruction3JLabel; private JLabel …

Member Avatar for JamesCherrill
0
165
Member Avatar for manel1989

hi every one! i have 2 applications one on eclipse and the other on VS2010C++, so i want to send parameters from the java code to the other, i just konw how to execute the c++ code from the java code. what i want is this : send paramters from …

Member Avatar for manel1989
0
324
Member Avatar for caswimmer2011

Hey all! I am in college doing a speech on programming and one of my topics is to explain the difference between Java, C, and Objective C. I have been programming with Java for 3 years now and just started with C last month, but I don't know the differences …

Member Avatar for Dani
0
458
Member Avatar for Stein102

Can anyone recommend me a good Data Structure and Algorithm book for java programmers? Possibly intended for game development, but not required to be. Thanks.

Member Avatar for prakash.seetharaman
0
115

The End.