Search:

Type: Posts; User: javaman1

Search: Search took 0.09 seconds.

  1. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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.
  2. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    lol.What do i have to do to make post #4 work?
  3. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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 =...
  4. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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:
  5. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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...
  6. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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++){
  7. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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?
  8. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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
  9. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    this is lines 19 and 20


    for(count=0;count <= n;++ count){
    kids[count]=1;
  10. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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...
  11. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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...
  12. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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"...
  13. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    for(count=0;index=(index + 1)%n;index<kids.length){

    --------------------Configuration: <Default>--------------------
    C:\Users\Desktop\countout.java:26: error: not a statement...
  14. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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...
  15. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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 []...
  16. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    --------------------Configuration: <Default>--------------------
    Enter # of children that play the game[<=100]:10
    Enter # of words in the sentence:[>0]:4
    Exception in thread "main"...
  17. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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...
  18. Replies
    43
    Views
    2,257

    Re: Count out program-- How do i do this?

    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){...
  19. Replies
    43
    Views
    2,257

    Count out program-- How do i do this?

    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...
Results 1 to 19 of 19