32,199 Topics

Member Avatar for
Member Avatar for Konstar

Last year there was this one kid in another programming class, but all the time he would brag about how he "broke" java. I glanced over his code and it was a mess. But it seemed to be correct. Even our instructor traced it and found no errors. However, whenever …

Member Avatar for Stefano Mtangoo
0
62
Member Avatar for gingerfish

Hello I have a code here. it generates random 2d array [B]kMean[2][3][/B] and then this program calculates the distance between random generated [B]kMean[2][3][/B]s and [B]data[][][/B]. but the problem is, when the random kMean is 1, then it calculates the distance, but when the number or kMean becomes more than one, …

Member Avatar for gingerfish
0
131
Member Avatar for jwmollman

Hello guys, I'm really stumped on this assignment. What I need to do is make a triangle's height based on the number entered by the user. So if the user enteres 4, the output would be this: $ $$ $$$ $$$$ And I can't figure out how to do that. …

Member Avatar for tong1
0
242
Member Avatar for blknmld69

Good Morning, Having all kinds of problems with my programs. Seems as though is trying to read the StudentList file but cant. Im confused. I run the program and it goes to the StudentList.java and gives the errors below after the code. PLEASE HELP! project is past due and the …

Member Avatar for blknmld69
0
402
Member Avatar for Wootens

Hey guys, I recently wrote this program and it compiles and works but I have two issues that need addressing and I'm a bit confused on how to solve them. Question 1) [CODE]System.out.println("What's your name?"); name = Scan.nextLine(); System.out.println("How old are you?"); age = Scan.nextInt(); [/CODE] I always thought Scan.next …

Member Avatar for Wootens
0
241
Member Avatar for alleybye

I need to do a program that the user will input a letter from alphabet then the program will show the alphabet that starts with the inputted letter. for example Letter: B B C D E F G and so on.. please help me guys.. ive been doing this almost …

Member Avatar for bops
0
562
Member Avatar for kandyhyatt

[CODE] 1. /* 2. * Program: Chapter 3 Lab 1 - Programming Project 8 on page 164 3. * 4. * This program caculates the solution to the cryptarithmetic 5. * puzzle TOO + TOO + TOO + TOO = GOOD where each letter represents 6. * a single digit …

Member Avatar for brandonrunyon
-2
119
Member Avatar for cirvelasares

please help me, in applet.. how to make a square..? and how can i move it..like a rectangle movement..?

Member Avatar for coil
0
59
Member Avatar for FNHA

I'm writing a deque implementation with ArrayList as required by my instructor. So far the body of the class looks like this [code=java] try { while (!endOfFile) { character = inputFile.readChar(); while (!character.equals('\u0003')) { if (character.equals('\u0008')) deck.removeBack(); else deck.addToBack(character); } } while (!deck.isEmpty()) { character = deck.removeFront(); if (character.equals('\u0003')) System.out.print("\n"); …

Member Avatar for FNHA
0
140
Member Avatar for Loveday

Good day all! Please I need someone to help me out by telling me what or how will I call up an Applet from a separate Java file that has a main method in it...thats to say, I will compile and run the Applet code from the other class with …

Member Avatar for NormR1
0
2K
Member Avatar for jackcfj0129

Write a program that lets the user enter loan amount and loan period in numbers of years and display the monthly and total payments for each interest rate starting from 5% to 8%,with an increment of 1/8. Your program should have at least [b]2 methods[/b],method for calculation and method to …

Member Avatar for tong1
0
1K
Member Avatar for LianaN

Hi! I'm developing a simple file manager. So, I have two components: JTree & JTable. When I open some folder in JTree, then JTable is updated according to the content of that folder. JTable contains 3 columns: file_type, file_name, file_bytes. The code works correctly. Now I need to add some …

Member Avatar for JamesCherrill
0
92
Member Avatar for hulk33597

i am making a project on speech recognition and i want to integrate it with window. i can open the active window by runtime class by voice but can't close that active window by voice .. like how can i invoke alt-f4,back_space and other special key for window without keypess... …

Member Avatar for peter_budo
0
126
Member Avatar for NewOrder

i want the array to run from one place in diagnol to another place in the array. i set the arguments. here they are [CODE] int rowStart=3; int rowEnd=5; int columnStart=3; int columnEnd=5; int columnX=columnEnd-columnStart; int rowY=rowEnd-rowStart; [/CODE] here is the single loop that i prepared: [CODE] if (rowY>0 && …

Member Avatar for NewOrder
0
103
Member Avatar for daudiam

Forward referencing is allowed during declarations when the undeclared variable is used in the LHS of an expression, but not if its in the RHS. Therefore, the following won't work : [CODE]class A { int a=h; int h; }[/CODE] But the following code works : [CODE]class A { int a=this.h; …

Member Avatar for daudiam
0
222
Member Avatar for daudiam

Is it true that during autoboxing, the type.valueOf() method is called (which creates a new object only if another with the same primitive constant is not in the intern list. This applies to cases where interning is allowed. Otherwise, it creates a new object using new() ). Is this right …

Member Avatar for daudiam
0
139
Member Avatar for PDB1982

I can't seem to get my counting loop to stop if m OR n are <=500. The loop stops only when m hits 499 right now, but I need it to cancel if n is 499. I have tried using a break statement, but I'm not sure what else to …

Member Avatar for jon.kiparsky
0
149
Member Avatar for Protoroll

In my tree class the user can set the fall color of whatever tree they choose, but it's not taking the colors I type in when I test it. [CODE]import java.awt.Color; public class Tree { private String treeSpecies; private int treePrice; private Color currentColor; private Color fallColor; private int treeAge; …

Member Avatar for coil
0
128
Member Avatar for flyingcurry

We have an assignment to write a program finding the nth Fibonacci number. On the web, there are some standard mathematical equations for this, but that would just defeat the purpose of this assignment if I use those formulas. I have my current code down here(with some sketchy back up …

Member Avatar for coil
0
1K
Member Avatar for blknmld69

[CODE] import javax.swing.*; // Needed for swing classes import java.awt.event.*; // Needed for the action listener import java.io.*; // Needed for the file and IOException import java.util.Scanner; // Needed for the scanner class import java.util.List; // Needed for the arraylist import java.util.Arrays; // Needed for the arraylict class /** This …

Member Avatar for peter_budo
0
229
Member Avatar for plasticfood

particularly from a txt file. for example if the file reads "name ###-####-#### address" all in one single line. how do i put all three items in three separate variables and print them?

Member Avatar for CrazyDieter
0
131
Member Avatar for menacingsprite

So I'm trying to build this program for class and the teacher didn't really show us how to do it and is leaving it up to us to figure it out. The directions are as follows: The program will input the divers name, the scores of the 5 judges, and …

Member Avatar for CrazyDieter
0
203
Member Avatar for shruti1210

Is the following code snippet show valid inheritance? [code]class A { int v; final String sayHello() { return "Hello"; } } class B extends A { public int sayHello(int a) { return 3 + a; } }[/code]

Member Avatar for JamesCherrill
0
77
Member Avatar for LianaN

Hi! I would like to add ActionListener to buttons stored in JToolBar. However, if I'm using the code bellow, then I could add only MouseListener ("addActionListener" doesn't work). So, is it possible to somehow add ActionListener? Thanks a lot! [CODE] JToolBar toolBarUpdateDocs = new BrowserToolBar(); toolBarUpdateDocs.setFloatable(false); toolBarUpdateDocs.getComponent(i).addActionListener(new java.awt.event.ActionListener() { public …

Member Avatar for LianaN
0
316
Member Avatar for mishra pradeep
Member Avatar for daudiam

[CODE]class hello { } class hello1 { public static void main(String aa[]) { hello ob[]={new hello(),new hello(),new hello()}; hello ob1[]=ob.clone(); // 1 } }[/CODE] ob is an array which is also treated as an object, and hence has a default clone method which is called at (1). But the default …

Member Avatar for daudiam
0
226
Member Avatar for justinwarner

Hey guys, So, I need to add booleans on my project for the final piece. I have all of it done but the booleans. Basically, I checked about 10+ links on google, and none of them really explained how to do booleans. So, what I need is something that does …

Member Avatar for ~s.o.s~
0
148
Member Avatar for ncstplaya1234

Hey guys, I'm trying to create a program that has three items and adds the cost of the three items and prints the final total with sales tax. I need a subtotal, sales tax, and total amount. I'm having a problem getting the program to calculate the quantity correctly and …

Member Avatar for ncstplaya1234
0
3K
Member Avatar for NewOrder

i understand what the code does. but i dont understand a few lines: [CODE]package il.co; public class LinkedListEx2 { public static void main(String[] args) { LinkedList list=new LinkedList(); list.add(new Car("BMW", 150000)); list.add(new Car("SUBARU", 60000)); list.add(new Car("TOYOTA", 58000)); list.print(); } } class LinkedList{ private Unit head; public void add (Car data){ …

Member Avatar for adams161
0
132
Member Avatar for amit.hak50

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Member Avatar for amit.hak50
-1
71

The End.