Hello.
So I'm wondering if there is a way to assign a probability to a certain event in the code.
Let's say that I want a certain arithmetic operation to have an 80% chance of happening (and make an if/else if statement based on that, or something similar...)
Is there something in the...
I have been trying to install Java and failed. After installation completed and close the installation window, an error message popped up saying:
"Wrapper.CreateFile failed with error 5: access denied."
The java don't work. I tried reinstalled a few times and still failed. Please help...
How can I make a box around text in Java which will appear in Windows cmd.exe?
Only using System.out.print("X"); and System.out.println("X"); . It MUST be a solid box and not use symbols like - or _ .
It can also use int X , double X, char X, String X, and boolean X.
Please explain...
I have an urgent need to learn to gather data using web services in java. I've picked up several books which all seem over my head. Can anyone recommend a stack of books and tell me what order to read them in? Otherwise if anyone can at least tell me what order I should tackle the necessary...
Homework Statement
Very simple: I want to allow my existing Java program to run in a browser. Very simple. I don't want to change any code around, I just want to open it in a browser instead. I have read many tutorials online, and they require that I add weird methods like destroy, init...
I have a program where the user selects image icons in one JPanel and can place them in another JPanel. The program saves the position of the icons as an array of integers where each integer represents the different icons. I need to also save the final result as a .gif image because otherwise it...
Hello,
I am currently enrolled in an introductory Computer Science course, and I've been having trouble with a Java/HTML project. I have been given the following code for a triangle applet to be linked in an HTML page I have to make:
import java.awt.*;
import java.applet.Applet;
public...
import acm.graphics.*;
import acm.program.*;
import java.awt.Color;
import java.util.Iterator;
import java.util.Random;
import java.util.List;
public class LAB1
{
final static int BLOCKWIDTH = 50;
final static int BLOCKHEIGHT = 10;
final static int NBLOCKS = 10;
final static...
In C++, pretty much any global main() function gets run. In C#, amy class's Main() method gets run, and having multiple Main() methods in multiple classes should give a compilation error(?). But if we have a .jar, when running it, how do we know which class's main() method the .jar will run?
I'm trying to run a java program I coded using geany but it would let me run it as it comes up with the following error message.
Exception in thread "main" java.lang.NoClassDefFoundError: temp
Caused by: java.lang.ClassNotFoundException: temp
at...
Can someone tell me why there's no output? I compiled it, and it should work, but there's simply no output (netbeans). It also says "incorrect package" at the top of every file.
It's a linked list that adds cars, sorts them, and (should) display the sorted results.
There's also an error in...
I'm trying a practice problem from the book. It's 10 books with title, ISBN, and year. The input needs to be sorted by year and it needs to let you search for a book title.
class LinkedStack
{
/**
The Node class is used to implement the
linked list.
*/...
Hi,
I made this program in java, take a look:
https://github.com/BetoKahn/Gauss
For the english version I didn't uploaded the code, only the runnable .jar file.
For the portuguese speakers you can see the code.
I hope you enjoy,
My teacher gave me a program in Java which none of us were able to do. So, I need help.
Homework Statement
We have to find the uppercase of the lowercase alphabets which the user inputs and vice versa. In case the character is special character, then it will leave blank space. It will work...
A coworker asked me if I had any recommendations for Java learning resources; I thought about it and really didn't have many since my programming life has been an odd mixture of Python, Fortran, and C++. And this got me wondering, does anyone have any good suggestions for Java learning resources...
Homework Statement
I just have a quick question and hope I can ask it clearly. If I am writing a constructor for a class that takes in one value as an argument, but the value is two words, how can I extract the first and second word?
For example, if I wrote a class called Name and my...
I'm having trouble with understanding how methods that have a parameter work.
For example,
public class Register
{
private double purchase;
private double payment;
public static final double QUARTER_VALUE = 0.25;
public static final double DIME_VALUE = 0.1;
public static final...
Homework Statement
I need to write a program that evaluates a postfix notation expression using a stack.
Homework Equations
5 3 2 * + 4 - 5 + = 12
The Attempt at a Solution
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/...
i know this topic has been discussed, but i would really want a direct reply and soon
Do i have to learn java or c++ in order for me to learn how to be a hacker?... good intentions off course, for security and privacy needs... please let me know. Thank you.
Homework Statement
I am supposed to write a program that has the user enter 10 nouns and 10 verbs. It then creates a 4 sentence story using the those words. I am getting an ArrayOutOfBoundsException when it gets to the part where it prints out the story. The exception is found in the grab()...
Homework Statement
This is my assignment: (Sorry, it's a little long)
You are required to write a UserID Java class to be used when generating and storing the user id and password for a new user of a system. At a minimum, each UserID object should store a first name, last name, user id, and...
Is there a way I can get the definitions from, say, dictionary.com?
Does much method already exist or do I have to go about creating one? How would I get a specific something from a specific website?
I prefer using java, but if there's another language that makes it easier, I also know C++...
Homework Statement
I am supposed to write a program that uses a bag of strings to keep track of a list of chores. The user can add, remove, view, etc. items on the list.
Homework Equations
When I run the program and i choose an option from the menu. It displays the menu again before...
I don't know why in the main method, the do-while loop won't work the way it's supposed to.
For instance, if the user types in y, the first loop would execute and then since the value of choice is still 'y', it's supposed to loop again. But instead, it just displays "TOSS COIN? Press y for...
Homework Statement
Create a Java class named ArrayTest with a method called arrayCombiner that creates three arrays of size 10. The first array should contain the values 1, 3, 5, 7, 9, 11, 13, 15, 17, and 19. The second array should contain the values 2, 4, 6, 8, 10, 12, 14, 16, 18, and 20...
Homework Statement
"Implement a new method for the bag class. The new method allows you to subtract the contents of one bag from another. For example, suppose x has seven copies of the number 3 and y has two copies of the number 3. Then after activating x.subtract(y), the bag x will have...
Homework Statement
I need to write a sorting method for my IntNode class. this is supposed to use the selection sort algorithm.
Homework Equations
selection sort algorithm given by problem
while(the first list still has some nodes
{
1. find the node with the largest element of...
Hi everyone!
I am a mobile robot designer in autonomous space robotics. there is a great dilemma in front of me to opt a programming language for the robots between C++ and Java.
the most important factor for me is performance of the language when i want to use it for applying very...
Hi,
I want to write a java program to get information from a USB communications port. I have downloaded the javax-usb-r1 package but I don't know where I should place this folder / package.
Can anyone give some advice?
Thanks
Homework Statement
I have to define part of a method that will take in a String, segment the input into words, keep track of how many of each word there are in the string, and then return a HashMap<String, Integer> that shows how many of each word there are in the string.
A separate helper...
The Android system is an OS by java for java, but why? What significant advantage does java posses over other languages? Is it because high-end hardware are so cheap and numerous, that no one need to think about the runtime efficiency anymore? Or because google want to make money, and somehow...
Homework Statement
This assignment handles topics of events and GUI-elements. It's a little game. The task: create a window with a button that randomly relocates to a different position on the screen each time it is hit. The player has to hit the button 10 times, the score is the time needed...
I am using Windows 7, netbeans 7.0.1 and the latest Java package
I am writing a simple while loop with hasNext() method as its condition, and supposedly the end-of-input indicator for Windows is Ctrl+Z, but that does not work for me. I also tried Ctrl-d, which supposedly works for Macs, unix...
Homework Statement
An n by n matrix that is filled with the numbers 1, 2, 3, … n2 is a magic square if the sum of the elements in each row, in each column, and in the two diagonals is the same value.
Write a class that creates a square matrix (as a two-dimensional array) andtests whether...
i'm trying to learn opengl with java (jogl binding), but there is no way i can set up things to work appropiately. I've spent hours trying to find the right files to download, and put them in the right folders and set the 'path' variables and so on.... but i couldn't get a success in hours, it's...
I've been learning C# but just want to give Java a go before I start learning the difficult bits of C# to see which I prefer, most people say the 2 languages are very similar but I just wanted to see for myself.
I really like having a code complete function in the IDE but I tried Netbeans but...
When you take the absolute value of an integer value:
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Math.html#abs(int)
Wondering if anyone can explain what abs does that makes it fail on the minimum integer value
I'm having a bit of a problem with physics calculation for a bouncy ball program I am creating in java. I've been java programming for almost three years, and excelled in my class, but when it comes to physics for java games and what not, I am totally useless. Heres the problem: a Ball, when put...
I have made a java code which displays a blue sphere and let's you control with the mouse where its illumination comes from. (its actually a circle and some parts are painted white/blue/black depending on the mouse position to make it look 3D)
here is the code
import javax.swing.*...
Hello everyone.
I am investigating this method and trying to find how random numbers are getting generated.
Please look at the following code.
class RandomNumbers{
public static void main(String[] args) throws InterruptedException{
int count=0;
while(true){
double d = Math.random()...
My teacher says : C language programs are portable on all platforms, which includes, Unix, Linux, windows etc.
My question : What is the difference between C language programs and Java language programs when all the programs of either languages can be run on any platforms?
My teacher says: C...
hello,
i'm kinda new in this programming thingy so i hope you guys can help me.
i wanted to code a program that can identify whether a banana is ripe or not. basically, i have two image of banana; one yellow in color and another one is green. so I'm thinking about using AI technique...
I know what Hashtable is. I have seen the methods that it contains and used these methods. I know the differences between the implementation classes. But I have not come across anything called 'Hashfunction' during the time when I was studying Collections framework. Is this 'Hashfuntion' has...
Homework Statement
There are three classes:
import java.math.BigDecimal;
import java.util.Date;
import javax.swing.JOptionPane;
public class CreateTicketList {
private ArrayObj aObj;
public CreateTicketList() {
aObj = new ArrayObj(new Ticket(), 100);
}
public void...
Like this is my program to change the words around in order. Like First two words go to the back. What I am having trouble is, How do I capitalize the first at the results section after
the words order have changed??
This is my program.
import java.util. Scanner;
public class...
Question: Write a program to convert 22 square metres into square kilometres.
Note: divide square metres by 1 million to produce square kilometres.
Note also that the answer is not zero!
I know the note says the answer is not zero but shouldn't it have some value other than 0 ?
My code...
Hello. The method here is to add an item to a heap. As the title states, I am getting the error "The operator > is undefined for the argument type(s) E, E" in the parenthesis after the while. I assume this is not the correct way to compare E values. Does anybody know what would be the correct...
I'm writing a method that checks a given coordinates neighbors to see if they are part of the path. the problem I am having with is the conditions that ihave to make sure i don't go outside of the grid. it doesn't seem that the two conditions for col are being checked. i put print statements...