36,051 Topics

Member Avatar for
Member Avatar for music_est_vie

Hello. I am a extreme n00b at programming in Java and was wonder if I could get some advice on how to execute some of basic commands. I am working on a group project in school (Computer Science 30) and my group is creating our own extreme basic version of …

0
65
Member Avatar for nabil1983

Okay i've created an array object with help from here like so: CdRecord[] array = new CdRecord[5]; array[0] = new CdRecord(); now i've used a while statement to write to the arrays , im writing CDName,AlbumName & NumberOfTracks... when i run my program it all works except that when i …

Member Avatar for emilchacko
1
161
Member Avatar for Sunny89

Rather than read in the sales data we will generate it randomly using the Math.random() function. Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and …

0
62
Member Avatar for lrolsto1

Alright, this is for a project designed to make us use inheritance. This is Creature, which is a subclass of Thing. Creature is supposed to be able to eat, move and tell what it ate. Here are my issues: 1. How do I use a constructor from Thing in Creature? …

Member Avatar for LReynolds
0
74
Member Avatar for jxmst32

I am currently writing a program in Netbeans which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the GUI however, I cannot figure out how to make the …

Member Avatar for phoenix911
0
366
Member Avatar for jackieoh
Member Avatar for wondering_ed

[CODE]import javax.swing.*; import java.sql.*; public class BankAccountDatabase{ public static void main(String[]args){ Connection conn=null; Statement stmt=null; ResultSet rs=null,rs1=null; String url="jdbc:mysql://localhost/bankaccount"; String username="roo"; String password=""; String query="",query1=""; String accname,accnum,accpin; int PIN,key,menu,AccountNumber; String a,b,c,d,f,g,h,i,j,x,y,z; double dep,withdraw; double balance=0.0; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(java.lang.ClassNotFoundException e){ System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } do{ a=JOptionPane.showInputDialog("MENU\n\n\n1 - Create Account\n2 - Delete …

Member Avatar for BestJewSinceJC
0
159
Member Avatar for vij123

my question is related to JSP and HTML. i have a jsp page which have three combo box and a button. one combo box for a class. two combo box for from_year, to_year. i want to reterive data on this same JSP page from database based on combo box value. …

Member Avatar for peter_budo
0
596
Member Avatar for skerdzius

What is the best way to flush the buffer of a Scanner? somescanner.nextLine() clears the buffer if it is not empty, butotherwise i get an extra nextLine.

Member Avatar for javaAddict
0
51
Member Avatar for firebugg

Hi, I am working on an assignment that does the following... When the program starts, it should look to see whether a file is present that contains a serialized array of vehicles. If so, it redisplays them. Otherwise, it generates random vehicles, writes them to a file, and displays them. …

Member Avatar for javaAddict
0
143
Member Avatar for w0rk4holic

how do i generate all the topological ordering of (directed acyclic graph), i have written a program that can find 1 topological ordering, the problem is once i am finished i am left with a empty linked list as my algorithm involves deleting the traversed nodes which is crucial for …

Member Avatar for ericklesterbran
0
820
Member Avatar for deepak.marur

Hi all, I want to configure Tomcat behind an SSL enabled Apache httpd server. Could anybody show me how to do this ?? I have successfully configured apache and tomcat for http requests. Thanks.

Member Avatar for masijade
0
63
Member Avatar for Tiny_trixer

Hi everybody! I'm currently working on an assignment for school. I'm creating a linked list (a line at the liqure store to be exact) and I'm a little stuck. Part of the code: [CODE] public void ekspederKunde() { System.out.println("Velkommen til polet! Vennligst vis gyldig legitimasjon.\n"); if (fremst == null) { …

Member Avatar for Tiny_trixer
0
121
Member Avatar for Santho786

I like to known that how to assign the value for the check boxes.. Since one would check either one or two check values.. I need to store the all the values in SQL Database either has 0 or 1.... i.e.., if it is checked as 1 or if it …

Member Avatar for selvasoft
0
98
Member Avatar for Ghada Ibrahim

Hello .. Hopefully you can answer my question.. We are working on a project that uses Netbeans as a java editor the project is a website that needs to be linked with Java functions and an Ontology, We built the website using HTML and we embedded the JSP code in …

Member Avatar for peter_budo
0
102
Member Avatar for help_please

Hi i need to change the random numbers in my output to random 'b''s that take up 2/3 of the array and random 'x''s to take up 1/3. Ive been at it for a few days and still have no clue on what to do. Heres my coding and output: …

Member Avatar for javaAddict
0
111
Member Avatar for simplyflawless

hey guys, i have to do this program and i'm having trouble with this certain part: Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, …

Member Avatar for phoenix911
0
164
Member Avatar for may781

Hey:) I am creating a project in java,but have been sick for the passed 3 weeks, so I am a bit stuck on how some of the code should look,and where it should be the details are that I am required to develope an application that will allow the user …

Member Avatar for jwenting
0
108
Member Avatar for johny321

Is there difference b/w Javascript & JSP. are JSP is the abbreviation of Javascript. In my point of view Java is totally different from Javascript. There is slight confusion about Javascript &JSP. Can any one explain it

Member Avatar for manoharsingh
0
126
Member Avatar for musikluver4

[code] //Date: 3/17/2010 import java.util.Random; public class Bingo { public static void main(String[] args) { Random bingo = new Random(); for (int i = 1; i <= 50; i++) { System.out.println("Card #" + i + "\n********"); System.out.println(); for (int j = 1; j <= 24; j++ ) { int bingoNum; …

Member Avatar for BestJewSinceJC
0
5K
Member Avatar for jmguerriero

I am trying to write some code to practice using methods. My goal is to get the user to input their weight. Then in the method I want to convert the earth weight to moon weight, which is earth weight / 6. I think I got it but I can …

Member Avatar for jmguerriero
0
424
Member Avatar for bustersox

I am having problems filling an array of objects with a txt file. It seems to me that it should work, but I get all 0's printed out. Please help! I cannot write the rest of my code until I figure this out. Also I get this error message: "Exception …

Member Avatar for bustersox
0
4K
Member Avatar for thebluestar

ShoppingListItem.java [CODE=java] package problem2class; public class ShoppingListItem { private String name; private int numOfItems; private double price; public ShoppingListItem(String name, int quantity, double pricePerUnit) { this.name = name; numOfItems = quantity; price = pricePerUnit; } public String getName() { return name; } public void setName(String name) { this.name = name; …

Member Avatar for thebluestar
0
226
Member Avatar for musikluver4

[code] //Date: 3/16/2010 import javax.swing.*; class PizzaChoice { public static void main(String[] args) throws Exception { char[] whatSize = { 'S', 'M', 'L', 'X'}; char size; double[] sizePrice = {6.99, 8.99, 12.50, 15.00}; int s; System.out.println("What size do you want?"); size = Character.toUpperCase((char)System.in.read()); for (s = 0; s < whatSize.length; …

Member Avatar for musikluver4
0
959
Member Avatar for sheps

Hi, I'm super new to Java, and am desperately in need of some help. I'm making a little java desktop application where I basically have a grid of 4 JButtons ( 2 x 2 grid), and I need the background colour of individual JButtons to change, and after one second, …

Member Avatar for Ezzaral
0
2K
Member Avatar for LReynolds

So here's the rundown. I have a base class, I want to put a clickHandler in it because all of my subclasses will need it, but they will all execute different code when it is triggered. My question is, how can i have a clickHandler in my base class and …

Member Avatar for Ezzaral
0
157
Member Avatar for BERRYH

Write a program that draws a clock face with a time that the user enters in two text fields (one for the hours, one for the minutes). import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.awt.geom.Ellipse2D; import …

Member Avatar for BERRYH
0
93
Member Avatar for rena0514

I get this when i click on the done button in my program: [CODE]Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at BillPanel.getTotalPrice(BillPanel.java:49) at BillPanel$ButtonListener.actionPerformed(BillPanel.java:62) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) …

Member Avatar for rena0514
0
194
Member Avatar for stain3d

Hello! I'm doing a thing to where the java program will let the user input a length, and width of a triangle. In return it will show the length, width, and the area. I think I have everything correct here, however, the public voids I inserted does not work... Any …

Member Avatar for cale.macdonald
-1
129
Member Avatar for KillerZ123

I am new to sockets and trying to make a simple two person chat program and I have everything working except for the receiving and printing of the messages to the jtextarea. I am not sure why it isn't working here is my code: Driver: [CODE]import java.awt.*; import javax.swing.*; public …

0
39
Member Avatar for Sunny89

Write a Java program that will generate random four letter words. The words must consist of only lower case letters. The program will prompt the user to enter the number of words to generate. The program should request that the user enter a number between 1 and 500 and ensure …

Member Avatar for peter_budo
0
814
Member Avatar for Sunny89

Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit

Member Avatar for javaAddict
0
72
Member Avatar for akonful

Trying to figure out why code wont work. Its gets 2 errors for String newS1 = s1.sort; String newS2 = s2.sort; I dont know how know whats wrong [CODE]public class anagram { public static void main(String args[]) { java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter the first string: "); String first …

Member Avatar for javaAddict
0
150
Member Avatar for ronyyy

Please solve this java program Design a class EmployeeSalary to reflect the salary of an employee in an organization.All employee will be facilitated with common increment rate of their rank.Each employee's gross salary will be comprised of the basic ,house allowance ,medical allowance and transport allowance.The house ,medical,and transport allowances …

Member Avatar for masijade
-1
102
Member Avatar for thebluestar

Account.java [CODE=java] package btclass; import java.util.Scanner; public class Account { private float amount;//actual amount private static float balance;//balance amout Scanner keyboard = new Scanner(System.in); public void deposit() { System.out.println("Enter the amount you want to deposit: "); float depos = keyboard.nextFloat(); if (depos < 0) { System.out.println("Amount you entered is < …

Member Avatar for javaAddict
0
158
Member Avatar for kiyu2keith

How do I exchange data from page to page? for example: on the 1st page I voted for 1 person, when I click submit it will go to the 2nd page that will let you see the output of the vote? I can't seem to do it, as I don't …

Member Avatar for peter_budo
0
170
Member Avatar for BEBELINDO

Hi .. Provably I'm setting this up the wrong way in Netbeans.. I open a new projetc and use the default main...then open a new empty java file and type my code , when I run this it runs fine but it doesn't ask for input ! [code]import java.io.*; public …

Member Avatar for javaAddict
0
188
Member Avatar for mgern26

Hi i am having an issue using Math.pow its telling me that math.pow wants (double,double) and im giving it (double[] , double) is there away to use an exponent on an array package project2; public class project2 { public static void main(String[]args){ double x [] = { -2.0,-1.0,0,1.0,1.5,2.5,3.0,4.0,8.0,12.0,16.0,20.0,24.0}; double f=0 …

Member Avatar for javaAddict
0
65
Member Avatar for cool2

hi i m doing a project on ftp server..i need some basic codes to start with the program..i ve got few codes but it has some package,enumeration all such stuff which is complex..so i need a simple progrm...plz help me in getting it......

Member Avatar for jwenting
0
78
Member Avatar for deepugtm

I'm doing my bachelor of engineering in computer. I do not know whether to post this thread here or not. Sorry for my poor English. I have the knowledge of C/C++. Now i have started learning Java. Some of my friends says that C# is better than Java., is it …

Member Avatar for jwenting
0
98
Member Avatar for hooimeinwong

Why i update one row of my data but end up it update all my data. For eg i update User : a to User: ab End with all User : ab

Member Avatar for masijade
0
33
Member Avatar for jxmst32

I am currently writing a program which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the JFrame and the JButtons to create the GUI however, I cannot figure …

Member Avatar for BestJewSinceJC
0
380
Member Avatar for litchi

Hi :) I was hoping someone could point me in the right direction to create a grid of clickable objects/images/shapes. My problem is this, I have to create a grid of 100+ characters that, when you click on one, appends a JTextArea with a specific, different, character. The only idea …

Member Avatar for litchi
0
1K
Member Avatar for WinnieM

Hi everyone, Im new to site and new to Java - have an assignment in Hangman - to date I have created the Hangman class and coded the tester so its working with 1 word! I have also coded the hangman component which is currently static and displayed on opening …

Member Avatar for BestJewSinceJC
0
96
Member Avatar for KirkPatrick

I have a question on how to get the index of a selected object. I'll briefly explain my project to help get a better understand of what I'm doing. I have created a simple object (named InfoObject) which is made up of 2 jTextfields and 1 jComboBox. I have added …

Member Avatar for Ezzaral
0
483
Member Avatar for lrolsto1

Stupid question, I'm sure: For an assignment I need to create a program that uses methods and constructors in several other classes... the classes were in a file that I unpacked and put in the same directory as the one I'm writing is in. What do I need to do …

Member Avatar for Ezzaral
0
95
Member Avatar for Katana24

Considering no one seems to be-able to answer my other thread I'll try simplifying this one. I have created GUI frame which contains a menubar at the top. I have several methods as well as a method which paints 5 circles onto the frame. When I call that method, by …

Member Avatar for BestJewSinceJC
0
80
Member Avatar for Dizzzy

Here is my code to write the arraylist to .dat file, And im not sure if its working but it writes to the file and i can see all the random characters so it is writing something but i keep getting io errors when i try to use the method. …

Member Avatar for BestJewSinceJC
0
156
Member Avatar for vampshay

import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; // user defined type where we put name class riot2{ private String name; public riot2(String _name){ name = _name; } public String toString(){ return name; } } public class finalriot2 extends JFrame{ Container c = getContentPane(); private Stack sstack; // …

Member Avatar for stultuske
0
75
Member Avatar for ace22

Hello, I'm working on a little project. I need to have program which: [B]1.[/B] reads textline from user (example: A little cat goes to town) [B]2.[/B] a) reads words what user wants to change to 0 (example word cat to 000) b) one word to one line and if given …

Member Avatar for ace22
0
92

The End.