Results 1 to 6 of 6
Thread: Please Help ASAP!
- 04-24-2012, 07:42 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 2
- Rep Power
- 0
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);
}
}
- 04-24-2012, 08:15 AM #2
Re: Please Help ASAP!
ASAP Help
Cross posted
http://openstudy.com/updates/4f948367e4b000ae9ecabc9d
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-24-2012, 08:19 AM #3
Member
- Join Date
- Apr 2012
- Posts
- 2
- Rep Power
- 0
Re: Please Help ASAP!
thanks ass!
- 04-24-2012, 08:33 AM #4
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.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
-
Re: Please Help ASAP!
Banned for 2 weeks.
- 04-24-2012, 02:25 PM #6
Member
- Join Date
- Mar 2012
- Posts
- 88
- Rep Power
- 0
Similar Threads
-
Please help me ASAP!
By Asvin in forum New To JavaReplies: 13Last Post: 05-17-2011, 05:55 PM -
Please need help asap
By Tamtome in forum New To JavaReplies: 9Last Post: 02-04-2011, 08:19 PM -
Need help ASAP, please
By KAM0002 in forum New To JavaReplies: 6Last Post: 12-08-2010, 04:58 PM -
Need help asap please!
By mbm4ever in forum Java AppletsReplies: 4Last Post: 08-12-2010, 03:57 PM -
Need some help ASAP
By varma in forum New To JavaReplies: 11Last Post: 01-08-2010, 12:15 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks