No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
7 Posted Topics
[CODE]do { String scoreString = JOptionPane.showInputDialog(null, "Enter a new score"); score[count] = Double.parseDouble(scoreString); sum += score[count]; } [U][COLOR="red"][B]while (score[count++] >= 0);[/B][/COLOR][/U] [/CODE] The highlighted line is where you have got it wrong. You are supposed to ensure that the array doesn't go out of bounds... i.e, count should be less …
[QUOTE]class Maze1 { String structure[][]; Maze1(){ String structure [][] = { /*you are creating another variable with the same name here*/ [/QUOTE] You have [U][B]declared[/B][/U] structure twice The compiler will associate the array elements to the second declaration of structure which has a local scope. Here is another way out …
Well, the compiler complains because you have not accounted for all the cases in your boolean functions. your functions look like: public boolean first() { if(something) { return anotherthing } } what if the condition fails ?. How will the compiler know what to do if the balance <=0 . …
Have you sorted the given array of 20 numbers in ascending order ?? If yes, then all those duplicates would be adjacent. Ex : 1 2 3 2 would turn out as 1 2 2 3. So, now try to count those duplicates. That would be the frequency.
[QUOTE]A correct order must have at least as many nuts as bolts, [U]and at least twice as many washers as bolts[/U], otherwise the order has an error.[/QUOTE] Well, you have done the opposite of what you should do.(line 32) According to the given question, number_of_washers should be greater than or …
When you type rectangles = new rectangle[numRectangles]; You are just creating an array of "rectangle references" and not an array of "rectangle objects". This is what you have done : Rectangle a; //the reference a has not being assigned to any object a.xmin=0; This is what you can do to …
while ((str = in.readLine()) != null) //file reading { display = str; mydisplay = Double.parseDouble(display); mydouble[a][b] = mydisplay; System.out.print(mydouble); } in.close(); I can suggest a something here ... 1. Use the split() method to split/separate a string according to a given pattern (regular expression). split() returns an array. Ex : …
The End.