Jump to content

Urgent Help plz!

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
mikesta

mikesta

    Newbie

  • Members
  • Pip
  • 4 posts
A common requirement is for a program to look for a given piece of data in an array by examining each position in the array in turn. This is known as a linear search. Write a program which reads and stores in an array 10 integers from the command line, and then prompts the user to enter a single integer from standard input. If the entered number occurs in the array, the program should print out the first index at which it occurs:

Write a program which reads and stores in an array 10 integers from the command line;;;;????????????what does this line mean ?? From my understanding
it means that when i run my program i.e.compile javac test.java then run
java test and write with this an array of integers i.e. Java test 1 2 3 4 5 6 7 8 9
how do i achieve this please help.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Are you having issues with getting input or with storing it in an array?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
mikesta

mikesta

    Newbie

  • Members
  • Pip
  • 4 posts
set of arrays are to be input from user and not generated randomly.... and an input of arrays from user is to be input when running the file i.e. java Test 1 2 3 4 5 6 7 8 9

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I understand the statement of the problem. What part of it are you having difficulty with? What do you have so far?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
He seems to be having trouble taking in command-line arguments...

class MyClass
{
    public static void main(String[] args)
    {
        // See that "String[] args" up there? That's where command line arguments
        // go. To use it, all you've got to do is extract the values from that set of args.
        // You can treat the args String array just like any other String array!

Wow I changed my sig!