32,199 Topics

Member Avatar for
Member Avatar for anumash

This program is based upon the quadratic equation. If I enter a negative discriminant it prints NaN instead of "No real solutions". Any help will be appreciated. Why is it printing NaN twice??? What modifications are needed in the code? Please help!!! [CODE]import java.util.Scanner; class QE{ private double d=0; private …

Member Avatar for anumash
0
118
Member Avatar for stephy1

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.[CODE] String id= t1.getText(); int c1=Integer.parseInt(rc1.getText()); /* rc1 is a radiobutton */ statementobj.executeUpdate("Update tablename(fieldvalue) values('"+c1+"')where ID='"+id+"'"); [/CODE]

Member Avatar for stephy1
0
191
Member Avatar for KKR_WE_RULE

The output I am getting is : [CODE]You will be entering the names of ten students their corrsponding marks in Physics, Chemistry & Maths. Enter the name of the student : student1 Enter the marks in physics of STUDENT1 : 43 Enter the marks in chemistry of STUDENT1 : 54 …

Member Avatar for KKR_WE_RULE
0
139
Member Avatar for pssubash

Hi, I created a class named [B]Test.java[/B] [CODE] public class Test { public Test() { System.out.println("Testing......"); } } [/CODE] It sucessfully compiles. Then i create another java class [B]Menu.java [/B]and here i trying to create an object of the Test class. [CODE] class Menu { public static void main(String[] args) …

Member Avatar for javaAddict
0
324
Member Avatar for stroper

I am making a console application. I want to make a method to stop the application. Can anyone help please. This is my code. [CODE]public void menu() { System.out.println("1 to go to menu help, 2 to go to head menu 3 to stop"); int optie = scanner.nextInt(); switch (optie) { …

Member Avatar for stroper
0
126
Member Avatar for mangopearapples

Hi, for some reason, my JScrollPane isn't working with mt JTextArea. Probably the most important part: [CODE] JTextArea TextArea; JScrollPane scroll; TextArea = new JTextArea(); scroll = new JScrollPane(TextArea); add(TextArea,BorderLayout.CENTER); add(scroll,BorderLayout.LINE_START);[/CODE] Whole code if you're interested in what I'm making: [CODE]import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.BufferedWriter; …

Member Avatar for mangopearapples
0
277
Member Avatar for careless_monkey

I'm just starting out on my Networking Assignment and I'm already stuck. Assignment asks me to check a the user provided website for links and to determine if they are active or inactive by reading the header info. So far after googling, I just have this code which retrieves the …

Member Avatar for masijade
0
189
Member Avatar for carinlynchin

hi, i have no idea why this isn't working....I placed some system.out.println's for debugging purposes and what I found is that after entering the "new game" method, thethe message shows in the console, but then the random initialization occurs, after which I placed another system.out and its not showing which …

Member Avatar for carinlynchin
0
194
Member Avatar for sj5536

How do i count space between two string in java for ex. String s = "This is my car"; i have to count number of space between this and is , is and my, and my and car.

Member Avatar for ztini
0
2K
Member Avatar for vin24
Member Avatar for SolidSora

I'm supposed to use an instanceOf for an assignment, and it says the type is incompatible. Here is my code: package City; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Brian */ public class City …

Member Avatar for ztini
0
96
Member Avatar for Taimoor Rana

I want to load an image for each different shoe and I'm using JLabel to help me do this. I put the image's path in the JLabel constructor but when the code runs, it doesn't display any image. Instead of an image, the image path is written. appreciate any help …

Member Avatar for ztini
0
243
Member Avatar for lashbandi

Hi... i am trying to run this program...and it stays that it does not have a main method... public static void... but i have the public static final int... please let me know how i can get this program to run..thanks [CODE]public class CaesarCipher { public static final int ALPHASIZE …

Member Avatar for ztini
0
207
Member Avatar for EmbeddedHelp

Hi all, Currently my code accepts x10 Floats into a Vector. How would I change it to terminate the loop and output all stored values when a negative number is entered? [CODE]import java.util.*; public class acceptFloats { public static void main(String args[]) { Vector<Float> vec = new Vector<Float>(); Scanner scanner …

Member Avatar for ztini
0
90
Member Avatar for kitty_wave

Hi guys, I am pretty new to java, and I have to write out an algorithm for a few operations following each other. The point I am at, is adding two numbers and then dividing the product. This is the code I have come up with so far, excuse the …

Member Avatar for ztini
0
81
Member Avatar for vin24

Hi, I created a program using the linkedlist package. I encountered an error when I tried to insert an element... By the way here's my code... [CODE] import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.util.*; class guiListOperations3 extends JFrame implements ActionListener { static LinkedList <String> list=new LinkedList <String>(); static JLabel …

Member Avatar for ztini
0
174
Member Avatar for atticusMom

Searched online and found ways that people are able to do this but I can't seem to get mine to incorporate all the words. Here is what I'm trying to do followed by my 7th try at coding it. Thanks in advance for any advise you may be albe to …

Member Avatar for ztini
0
167
Member Avatar for conztantines

write a function that will reverse the numbers in a row? so far done public void fliprow(int r) { int temp = m[r][m[r].length-1]; int ct = 1; for(int column = m[r].length; column >= 0; column--) { m[r][column] = m[r][ct]; m[r][ct] = temp; temp = m[r][m[r].length-ct]; if(ct < m[r].length) ct++; else …

Member Avatar for ztini
0
88
Member Avatar for techie929

Hi, I am getting "java.lang.ArrayIndexOutOfBoundsException" exception in my program. Below is the code. [CODE] int ind = 0; for(int i = 0; i < height; i++){ for(int j = 0; j < width; j++){ byte a = 0; byte r = bytes[ind]; byte g = bytes[ind+height*width]; byte b = bytes[ind+height*width*2]; …

Member Avatar for ztini
0
182
Member Avatar for MoZo1

I have a database application in Java. They want to access the data from primarily Excel2007 and secondarily Visual basic. I need some advice about with what library could I easily add this functionality. I've tried Simple OLE DB Provider with some JNI, but it's unstable and I'm... grrr. So …

0
68
Member Avatar for CompSci_Guy

As the title says, I saved over my code. I am screwed because I really need the old version. I have the original compiled .class file... can i some how get the code from inside there? or recover an earlier version of this java file (which is/was stored on my …

Member Avatar for stultuske
0
156
Member Avatar for hoven

[CODE]import java.util.*; import java.text.*; public class Interest { static DecimalFormat fmt=new DecimalFormat("0.00"); //2 decimal place. static Scanner input=new Scanner(System.in).useDelimiter("\r\n"); static double[] principle = new double [10]; static double[] rate = new double [10]; static double[] interest = new double [10]; static double[] days = new double [10]; static int i; …

Member Avatar for hoven
0
138
Member Avatar for shailu_01

hi i am using windows 7 in laptop. i download java thro net. i dont know, how to run in windows 7.also in cmd prompt, java have r not. pls tel me elaborately step by step pls

Member Avatar for peter_budo
0
121
Member Avatar for techie929

Hi Everyone, I have rgb values for each pixel.I have stored each red,green and blue values in three arrays red[][],green[][] and blue[][]. Now I want to display a rgb image using these values. Please suggest me how to do this. Thanks.

Member Avatar for peter_budo
0
90
Member Avatar for Sidd_

hi I am unable to find any solution on how to create run time radio buttons . eg. if I selcet source and destination then all the train(with its detail like train no. etc) in this route will be displayed with radio buton. just like we see in railway reservation …

0
69
Member Avatar for eman 22

I want to insert an image from my hard disk into the application but unfourtantly my code doesn't work and I can't determine what causes that the image disapear.[CODE] import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.image.Image; import javafx.scene.image.ImageView; /** * @author city */ def image = Image …

0
57
Member Avatar for caswimmer2011

Hello, I am doing my first JFrame. I want it to have a button where the user clicks it and music plays. I already made the button (called b1) but i can't seem to find code for the music to be imported and played. I have tried a whole bunch …

0
123
Member Avatar for coco24

Hi, this is my first program using JUnit and I am very lost, this is the piece of code that I am running the test on [CODE] public class BoundedBag { // Data members private int[] contents; // Elements of the BoundedBag. private int topPosition; // Index of highest used …

0
78
Member Avatar for coco24

Hi, I am having problems with this piece of code and maybe I am just not understanding how to do it, but can you please help me out or give me some tips. This is the description: You will implement your BoundedBag as a partially filled array. The array contents …

Member Avatar for VernonDozier
0
2K
Member Avatar for SVW

I would like to complete a project that requires a name as a console input, but returns an output of that name in reverse. It should only use for-loops and strings/substrings. I think it needs to use an array to get it done. I am right? Below is my attempt …

Member Avatar for SVW
0
131

The End.