32,204 Topics
| |
Hi, I am working on a program for one of my courses. The program requires the use of a command line argument. I am using JCreator and as such my code does not work. Is it not possible to run a program with a command line prompt from JCreator? Thanks | |
[B]I m doing some problems regarding Return type in java.I m facing some problem . could any help plz.[/B] 1. class Plant { 2. String getName() { return "plant"; } 3. Plant getType() { return this; } [B]// what mean 'return this' here [/B] 4. } 5. class Flower extends … | |
how to solve this easy problem????? Write a Java program that would input ten numbers form the user and print the ten numbers sorted in descending order. | |
public class HealthProfile { private String healthfirstName; private String healthlastName; private String gender; private Float birthday; private Float weight; private Float height; private Double maximumheartrate; private Double targetheartrate; private Double bmi; //starter public void setHealthfirstname( String name ) { healthfirstName = firstname; } public String getHealthfirstname() { return healthfirstName; } … | |
Hi, I wrote a code to solve the knapsack 0-1 problem by dynamic programming. At a certain point, around 30 max capacity, the code stops adding new values based on the incrementing max capacity and item values. I have no idea why, it finds the correct solution until the max … | |
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 … | |
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, … | |
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. … | |
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 … | |
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 … | |
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 … | |
[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 … | |
please help me, in applet.. how to make a square..? and how can i move it..like a rectangle movement..? | |
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"); … | |
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 … | |
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 … | |
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 … | |
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... … | |
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 && … | |
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; … | |
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 … | |
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 … | |
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; … | |
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 … | |
[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 … | |
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? | |
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 … | |
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] | |
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 … | |
please send me the whole code of java wed site |
The End.