had to submit it already. We can use those Array.toString yet since the lecturer did not teach it and does not want us implementing things he did not teach.
Type: Posts; User: javaman1
had to submit it already. We can use those Array.toString yet since the lecturer did not teach it and does not want us implementing things he did not teach.
lol.What do i have to do to make post #4 work?
is this close? im getting an infinite loop then my program crashed.
System.out.printf("Enter a number:");
int n = in.nextInt();
System.out.printf("Enter a value for m:");
int m =...
whats is stack trace?
the code is doing it because the question asked to do it. I dont know what else to do. Ill have to submit it as it is.:confused:
it compiles but after i enter the values for the # of children and the # of words it gives out of bounds.
public static void Remain(int n,int m){
int [] kids = new int[n];//array int holds...
like this?
public static void Remain(int n,int m){
int [] kids = new int[n];
while(kids[n] !=1){
for(int j=1;j<=kids.length;j++){
for(int i=1;i <=m;i++){
nothing is working:mad:
its due at 6 this evening.
can i use a for loop inside another for loop?
and how do i eliminate a child if im using an array of integers?
ok i made some changes and im not getting any errors.However when i enter data nothing happens after that. It just accepts the data and the cursor blinks on the screen
this is lines 19 and 20
for(count=0;count <= n;++ count){
kids[count]=1;
it is not giving an error at a particular statement. when i click compile it complies normal without any errors. the program then prompts me to enter the values. After i enter the values . the out of...
its compiling without errors then im prompted to enter data. After i enter the data it is giving the out of bounds error.
here's my method:
public static void Remain(int n,int m){
int...
ok this is what i did for the for loop. Its not giving an error anymore. but after the program compiles and the user is prompted to enter values im still getting this.
Exception in thread "main"...
for(count=0;index=(index + 1)%n;index<kids.length){
--------------------Configuration: <Default>--------------------
C:\Users\Desktop\countout.java:26: error: not a statement...
ok can this work with an array of int?
or does it have to be Boolean?
and how do i solve the array out out bounds error?
Enter # of children [<=100]:10
Enter # of words in the sentence:[>0]:4...
post #4 was my first attempt. but its not working.
i Still dont understand how to iterate the array circularly.
this is my method:
public static void Remain(int n,int m){
boolean []...
--------------------Configuration: <Default>--------------------
Enter # of children that play the game[<=100]:10
Enter # of words in the sentence:[>0]:4
Exception in thread "main"...
here's what i got so far.Its compiling good but after its runs im getting out of bounds error.
import java.util.*;
public class Countout{
public static void main (String[]args){
Scanner in...
this is what i have so far. I just threw something together. I dont understand how to code this program
import java.util.*;
public class Countout{
public static void main (String[]args){...
The children’s game of ‘count-out’ is played as follows: n children (numbered 1 to
n) are arranged in a circle. A sentence consisting of m words2 is used to eliminate
one child at a time until one...