Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Simple Java program not compiling.
Post Body

Hey everyone I am trying to finish up some java homework however I am still getting compiling errors and I can't understand why. Looking for a little help from this awesome sub Reddit thanks.

  /**
     * Class: CS219
     * Course: Programming Fundamentals
     * Author: Mike Mayoros
     * Date: 10/25/2017
     * */
    import java.util.ArrayList; //import  Array List verse Array
    import static java.util.Arrays.sort; //Import sorting array
    import java.util.Scanner; // scan for user inputs
    public class MMUnit2Ch10 //main name
        {
        public static void main(String[] args)
        {
        int [] unsortedArrayList = new int[10]; //This Defines arraylist
        Scanner scan = new Scanner(System.in); //this scans for user The user inputs
        for (int i = 0; i < unsortedArrayList.length; i  )
        {
        int randomNumberGenerator = (int) (Math.random()*100) 1;// this was used to find random number up to 100
        unsortedArrayList[i] = randomNumberGenerator; //The user inputs random numbers into unsorted array
        }
        int [] sortedArrayList = new int[unsortedArrayList.length];
        System.arraycopy(unsortedArrayList, 0, sortedArrayList, 0, unsortedArrayList.length); //copy unsorted to sorted
        sort(sortedArrayList);//sort the array list
        System.out.println("Unsorted Array List \tSorted Array List"); //print line 
        for (int i=0; i<unsortedArrayList.length; i  )
        {
        System.out.printf("%d\t\t\t%d\n",unsortedArrayList[i],
        sortedArrayList[i]);
        }
        System.out.print("\nPlease enter number to search for: ");//asks the user input number
        int userThe; user inputsNumber = scan.nextInt();//takes The user inputs number
        int count = 0;//This Defines count
        boolean found = false; //This Defines boolean found
        for (int userNumber : unsortedArrayList)
        {
        count  ;
        if (userNumber == userThe);//true if user The user inputs number matches usernumber
        {
        System.out.println("Search Value: "   userNumber   " found at location: "   count   " in the unsorted array list");
        found = true;
        }
        }
        count = 0;
        for (int userNumber : sortedArrayList)//true if user The user inputs number matches usernumber
        {
        count  ;
        if (userNumber == userThe);//if true
        System.out.println("Search Value: "   userNumber   " found at location: "   count   " in the sorted array list");//print location of user number in sorted
        }
        if (!found)
        {
        System.out.println("Search Value: "   userThe   user); inputsNumber; "was not found";//print if number wasn't in the lists
        }
      } 
    } // end class

Errors Below

/MMUnit2Ch10.java:52: error: not a statement
    System.out.println("Search Value: "   userThe   user); inputsNumber; "was not found";//print if number wasn't in the lists
                                                           ^
/MMUnit2Ch10.java:52: error: not a statement
    System.out.println("Search Value: "   userThe   user); inputsNumber; "was not found";//print if number wasn't in the lists
                                                                         ^
2 errors

Author
Account Strength
90%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,971
Link Karma
685
Comment Karma
1,266
Profile updated: 4 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago