All Questions
174 questions
26votes
6answers
3kviews
HashSet and TreeSet
I got some homework in which I had to take the novel War and Peace and put it into a HashSet and TreeSet respectively. I had to time it, to check differences and my question is whether my ...
20votes
3answers
75kviews
Java implementation of spell-checking algorithm
This little program was written for an assignment in a data structures and algorithms class. I'll just note the basic requirements: Given an inputted string, the program should check to see if it ...
17votes
7answers
143kviews
Finding repeating numbers in an array
I want to search through an array of n numbers and find the numbers that are repeated. So far I have this code, which does the job, but I find it to be a rather cumbersome method, but I can't seem to ...
16votes
5answers
27kviews
Yahtzee game (using arrays and object classes)
As part of an assignment for my intro Java class (please bear with my beginner skill set), I'm working on a program for which a Die object class is used to play a Yahtzee game. An overview of the ...
13votes
5answers
4kviews
Enter my Matrix
Here is my next Java assignment: create a Matrix class that can add and multiply two matrices together. I was given some code as a skeleton and then fleshed it out ...
12votes
6answers
17kviews
Does my Rock Paper Scissors game look good?
I'm doing some homework and am just curious if everything I've done looks good and/or if you'd suggest I modify something to keep with "javaese." ...
11votes
8answers
18kviews
Return a string without the first two characters
I'm new to Java and am trying to solve a scenario. Even though I've succeeded and it works, I've just wondered if there was a more practical way of doing this task. Is there a quicker or more ...
11votes
4answers
8kviews
Payroll calculator
First I tried to fetch this program as close to pseudo code where I must follow all imported items, all method definitions, and all defined variables; anything else was my choice. After I created ...
11votes
4answers
4kviews
Turning an array of words into a random license plate
This is an assignment question from school: Write a method called licencePlate that takes an array of objectionable words and returns a random licence plate that ...
11votes
2answers
24kviews
Hash table implementation in Java
For class, I was asked to write a (linear probing) hash table in Java. (I was also asked to write a linear-chaining hash table, which is why I named this one ...
11votes
1answer
51kviews
Java multi-thread file server and client
My task was to build a multi-thread file server and a client that can upload or download a named file over sockets. It is assumed that the client will finish after its operation and there is no need ...
10votes
5answers
5kviews
Entering two integers and returning a decimal fraction
After a couple of small programs in Python we are now asked to do some basic stuff in Java. I don't really know where to start to improve this and whether it's even necessary. This is an exercise, so ...
10votes
2answers
2kviews
Guess a random number between a selected interval
My project for my class is to create a Java-based game where the user must enter a number between 1-20 and a number between 250 and 300. The computer randomly chooses a number between those 2 numbers. ...
9votes
3answers
26kviews
Finding points with the shortest distance
This takes in a user specified number of points then finds the two points with the shortest distance. ...
9votes
1answer
810views
Java application for finding permutations efficiently
I am an eighth grader with a school project of creating and application in Java that returns the total permutations of two given numbers. It needs to be light and efficient, for later deployment on a ...