# Search:

Type: Posts; User: ksahakian21

1. ## Thread: Need help understanding recrursive and static methods

by ksahakian21
Replies
1
Views
455

### Need help understanding recrursive and static methods

I'm having trouble understanding the concepts of static methods, and how to call them. Also how recursive methods work through.

for example, take this code:

public static void recur2 (int...
2. ## Thread: Program to check how many people are born on the same day of the month

by ksahakian21
Replies
6
Views
1,239

### Re: Program to check how many people are born on the same day of the month

I did eventual figure this out after getting my head wrapped around it.

import javax.swing.JOptionPane;

public class BDayMTester{
public static void main(String[] args){
final int...
3. ## Thread: Program to check how many people are born on the same day of the month

by ksahakian21
Replies
6
Views
1,239

### Re: Program to check how many people are born on the same day of the month

Sorry to keep posting walls of code, but I think I've almost found the solution. I don't believe I'm getting a correct average from the 10,000 trials though. Here is my new code:

import...
4. ## Thread: Program to check how many people are born on the same day of the month

by ksahakian21
Replies
6
Views
1,239

### Re: Program to check how many people are born on the same day of the month

yes, as long as the day is the same, the month doesn't matter
5. ## Thread: Program to check how many people are born on the same day of the month

by ksahakian21
Replies
6
Views
1,239

### Program to check how many people are born on the same day of the month

Assuming there are exactly 30 days in a month, I need to write a program that considers if there are K people in a room, what is the likelihood that at least M of them were born on the same day of...

by ksahakian21
Replies
1
Views
1,289

### Opoly game

Opoly Game Rules:
Reward starts at 20
1. Board cells divisible evenly by 5 double the reward
2. If the piece lands on the second to last cell of the board, reward is reduced to 1/4 of its...
7. ## Thread: code to check two int arrays to see if mirrors of each other

by ksahakian21
Replies
1
Views
892

### code to check two int arrays to see if mirrors of each other

Trying to make a method that takes in two int arrays then reports true if they are mirror images of each other, or false if they are not. Assuming both arrays are of the same length.

example:...
8. ## Thread: Java recursive calls

by ksahakian21
Replies
2
Views
1,242

### Java recursive calls

I'm having a little bit of confusion on how recursive calls work.
What does the method call recur2(5) display with the following code?:

public static void recur2 (int n)
{
if(n<=0)
{
...
9. ## Thread: Method to take in a string sentence and reverse the tokens

by ksahakian21
Replies
1
Views
714

### Method to take in a string sentence and reverse the tokens

import java.util.StringTokenizer;

public class StringTokens{

public String reverseWords(String sentence){
StringTokenizer tokens = new StringTokenizer(sentence);
String result =...
10. ## Thread: Dice score program

by ksahakian21
Replies
7
Views
882

### Re: Dice score program

Not sure if this is the right way to go about this or not, but I'm trying to make a new method in the SimpleDice class which (might?) allow me to call the diceCount variable from the DiceTester class...
11. ## Thread: Dice score program

by ksahakian21
Replies
7
Views
882

### Re: Dice score program

Thanks I should have realized that.
Does anyone know of a way to get my original code to work? Utilizing the throwSetDice method in the SimpleDice class.
12. ## Thread: Dice score program

by ksahakian21
Replies
7
Views
882

### Re: Dice score program

I would like to be able to utilize the SimpleDice class more, but I edited the DiceTester class to do the work of the throwSetDice() method. Now I'm running in to another problem though. When...
13. ## Thread: Dice score program

by ksahakian21
Replies
7
Views
882

### Dice score program

This is a small project for my class. Need to write a code that takes in two integers in the main class. One integer is the number of dice to be thrown, and the second is a score. The program...
14. ## Thread: How to make calls to methods

by ksahakian21
Replies
4
Views
1,170

### Re: How to make calls to methods

Another question with similiar idea.

The method stringRoot is passed a string of digits as a paramater and returns the square root of the number represented by those digits.

public double...
15. ## Thread: How to make calls to methods

by ksahakian21
Replies
4
Views
1,170

### How to make calls to methods

New here, I'm a compsci student taking a java programming class. Pretty basic suff but I'm getting caught here and there wrapping my head around some stuff.

My question right now invoves making a...
Results 1 to 15 of 16