Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

since Apr 01, 2013

Cows and Likes

Cows

Total received

0

In last 30 days

0

Total given

0

Likes

Total received

0

Received in last 30 days

0

Total given

0

Given in last 30 days

0

Forums and Threads

Scavenger Hunt

Ranch Hand Scavenger Hunt

Greenhorn Scavenger Hunt

Hi, I need to test the methods in this code. In the Main method I need to create a list of strings of however many I want, ex 5, and then test the methods in the code provided, except the iterator one. I also need to be able to print the list, iteratively somehow? I just can't figure out how to start the main, would someone be able to give me an example of how to test one of the methods? I could probably figure the rest out then. Thanks!

I also posted here, http://www.java-forums.org/new-java/83655-linkedlist-question.html#post362584

I also posted here, http://www.java-forums.org/new-java/83655-linkedlist-question.html#post362584

8 years ago

I've realized that the second list is sorted, there are just no spaces between the double digit numbers. I can't think of any way to add spaces between the numbers.

8 years ago

I'm trying to write a program that generates 100 random number, prints them, then sorts them, then prints out the sorted list with ten numbers in each line. I cannot figure out what is wrong with my code. Anyone have any ideas? A detailed explanation would be awesome as I am new to this. This is what I have so far.

And here is an example of what it prints out right now.

42629035334048469325

21775561975248917456

9340882010067304331

5542393117952289996

3775521286392295798

83166760847191818556

696337363376546310037

99637451574393191

54155896825250881413

4479358294746523

1244455688

9111213141516202123

23252829293031313333

35363737373739394040

42434546474848505252

52525454545556565757

58586061626363676769

71747475767779818283

84858688909191919393

9393969696979899100100

As you can see all of the lines have more than 10 numbers in them except for the first line of the sorted list, which is also the only line that is sorted. Any help would be appreciated, thanks.

And here is an example of what it prints out right now.

42629035334048469325

21775561975248917456

9340882010067304331

5542393117952289996

3775521286392295798

83166760847191818556

696337363376546310037

99637451574393191

54155896825250881413

4479358294746523

1244455688

9111213141516202123

23252829293031313333

35363737373739394040

42434546474848505252

52525454545556565757

58586061626363676769

71747475767779818283

84858688909191919393

9393969696979899100100

As you can see all of the lines have more than 10 numbers in them except for the first line of the sorted list, which is also the only line that is sorted. Any help would be appreciated, thanks.

8 years ago

Paul Clapham wrote:So, again breaking that task down into smaller pieces, would that mean that you don't know how to use a JOptionPane to input something? Or is it the inputting of a number that's giving you the problem? Or inputting 32 numbers?

All of it :[

JOptionPane.showInputDialogue?

I really have no idea how to go about it.

9 years ago

Okay, I'm not sure how to use JOptionPane to input two lists of 32 numbers in the Load method. I don't know how to start.

9 years ago

I'm trying to use the JOptionPane and a while loop to input two lists ( so two arrays?) of 32 numbers, which are made up by the user. The data cannot be sorted before it is entered into the arrays. It is supposed to ignore the numbers -1000 and 1000. I need to be able to print the average high and average low of the numbers and lows or highs position in order with the day( the index of the array?). I'm new at this so any help is appreciated. Here's what I have so far.

9 years ago

I am trying to write a method to calculate a value raised to an integer power (which I think is now correct). I need to display all the sines ( out to six decimal places, I assume you would use df.format?) for the angles 0 to 90 and also display the Math.sin values for the same angles. What I have written so far displays Sine of 1=0, Sine of 2=-0, up to sine of 67 where it says Sine of 76=?. I just need to figure out how to get it to display the sine values correctly. I am using eclipse and displaying in the console if that matters. Any help is appreciated! Thanks!

Someone also said, "I'm not familiar with the equation you're using to calculate sine but I think I can see why you keep getting 0.

You initialize "ans" with the value with 0, and then then you do ans = ans * term. But the value of ans is 0 so you are always multiplying "term" by 0, then setting "ans" equal to that value (which is always 0)."

Does anyone know how to fix it?

This is what i have so far,

Someone also said, "I'm not familiar with the equation you're using to calculate sine but I think I can see why you keep getting 0.

You initialize "ans" with the value with 0, and then then you do ans = ans * term. But the value of ans is 0 so you are always multiplying "term" by 0, then setting "ans" equal to that value (which is always 0)."

Does anyone know how to fix it?

This is what i have so far,

9 years ago