Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Fubarable

Thread: Please Help ASAP!

  1. #1
    PleaseHelp is offline Member
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Default Please Help ASAP!

    Hi, to begin I am a complete novice so yes I know its not perfect by any means, please excuse/critique my mistakes :) the assignment I would like to complete is specified here:
    a. Display your name to the screen and some info you get from the user’s computer and the date the program is executed. Use the same method you used for your previous assignment. (DONE)
    b. Ask user for the number of nonnegative whole numbers to be entered, create an array of that length, and then ask the user to enter the numbers one at a time. (DONE)
    c. Your program will store the numbers in an array. (DOnE i think!)

    d. If the input number is negative. (DONT KNOW/UNDERSTAND)
    • You ignore the number (do not accept it nor use it in your calculations)
    • You give user a warning that an illegal negative number has entered.
    • Go back to your loop and ask for another input.

    **so i have researched and give me a little break this is an online class so I have to figure it out on my own and I have found that maybe I should store the number in an array list?! but how ever if I do that that would therefore make what I have done pointless and have to redo it?! I just need some guidance and hopefully as soon as possible?! THANK YOU! this is what I have so far:

    package mystatisticsdemo;
    import java.util.*;
    /**
    *
    * @author Linette
    */
    public class MyStatisticsDemo {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {

    System.out.println("\t\t\t\tHello " + System.getProperty("user.name") + "!");
    String os = System.getProperty("os.name");
    String version = System.getProperty("os.version");
    System.out.println("\t\t I am running "+os+", version "+version);
    System.out.println("\tYour assignment was completed on " + (new Date()));

    System.out.println("\n\nPlease enter a non-negative whole number to "
    + "represent the length of your array:");

    boolean positiveEntry = false;
    Scanner keyboard = new Scanner(System.in);
    int arrayLength;

    do
    {
    arrayLength = keyboard.nextInt();
    if ((!(arrayLength == 0)) && (arrayLength > 0))
    {
    positiveEntry = true;
    int[] statsArray = new int[arrayLength];
    System.out.println("Your array will contain " + statsArray.length +
    " numeric entries. Input each one at a time below");
    for(int index = 0; index < statsArray.length; index++)
    statsArray[index] = keyboard.nextInt();
    }
    else
    System.out.println("Invalid entry, please enter a positive whole number:");
    }
    while (arrayLength <= 0);
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,304
    Rep Power
    20

    Default Re: Please Help ASAP!

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    PleaseHelp is offline Member
    Join Date
    Apr 2012
    Posts
    2
    Rep Power
    0

    Default Re: Please Help ASAP!

    thanks ass!

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,304
    Rep Power
    20

    Default Re: Please Help ASAP!

    Oh yeah. That's going to get members here falling over each other trying to help you. Not.

    I was wondering why the VB forums deleted your other cross post so soon. Now I know.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  6. #6
    lannie1980 is offline Member
    Join Date
    Mar 2012
    Posts
    88
    Rep Power
    0

Similar Threads

  1. Please help me ASAP!
    By Asvin in forum New To Java
    Replies: 13
    Last Post: 05-17-2011, 05:55 PM
  2. Please need help asap
    By Tamtome in forum New To Java
    Replies: 9
    Last Post: 02-04-2011, 08:19 PM
  3. Need help ASAP, please
    By KAM0002 in forum New To Java
    Replies: 6
    Last Post: 12-08-2010, 04:58 PM
  4. Need help asap please!
    By mbm4ever in forum Java Applets
    Replies: 4
    Last Post: 08-12-2010, 03:57 PM
  5. Need some help ASAP
    By varma in forum New To Java
    Replies: 11
    Last Post: 01-08-2010, 12:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •