Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4074842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:13:20+00:00 2026-05-20T17:13:20+00:00

I have this problem and i want it that when a user enters a

  • 0

I have this problem and i want it that when a user enters a lower case word. I want my program to take lower case strings in array and upper case strings in an array.

/**
   The ObjectSelectionSorter class provides a public static
   method for performing a selection sort on an numbers of
   objects that implement the Comparable interface.
*/

public class ObjectSelectionSorter
{

   /**
      The selectionSort method performs a selection sort on an
      numbers of objects that implement the Comparable interface.
      @param numbers The numbers to sort.
   */

   public static void selectionSort(Comparable[] numbers)
   {
      int startScan;       // Starting position of the scan
      int index;           // To hold a subscript value
      int minIndex;        // Element with smallest value in the scan
      Comparable minValue; // The smallest value found in the scan

      // The outer loop iterates once for each element in the
      // numbers. The startScan variable marks the position where
      // the scan should begin.
      for (startScan = 0; startScan < (numbers.length-1); startScan++)
      {
         // Assume the first element in the scannable area
         // is the smallest value.
         minIndex = startScan;
         minValue = numbers[startScan];

         // Scan the numbers, starting at the 2nd element in
         // the scannable area. We are looking for the smallest
         // value in the scannable area. 
         for(index = startScan + 1; index < numbers.length; index++)
         {
            if (numbers[index].compareTo(minValue) < 0)
            {
               minValue = numbers[index];
               minIndex = index;
            }
         }

         // Swap the element with the smallest value 
         // with the first element in the scannable area.
         numbers[minIndex] = numbers[startScan];
         numbers[startScan] = minValue;
      }
   }
}




import java.io.*;

/**
   This program demonstrates the search method in
   the IntBinarySearcher class.
*/

public class BinarySearchTest
{
   public static void main(String [] args) throws IOException
   {
      int result;
      String searchValue;
      String input;

      // An array of numbers to search.
      String[] numbers = {"Jake", "Jerry", "Bill", "Lousie", "Goku", "Ivan", "John", "Sarah", "Kim"};


      // Create the console input objects.
      InputStreamReader reader =
                 new InputStreamReader(System.in);
      BufferedReader keyboard =
                 new BufferedReader(reader);

      // First we must sort the array in ascending order.
      ObjectSelectionSorter.selectionSort(numbers);

      do
      {
         // Get a value to search for.
         System.out.print("Enter a value to search for: ");
         input = keyboard.readLine();
         searchValue = input;


         // Search for the value
          result = ObjectBinarySearcher.search(numbers, searchValue);
                    // Display the results.
        if (result == -1)
           System.out.println(searchValue + " was not found.");
        else
        {
           System.out.println(searchValue + " was found at " +
                              "element " + result);
        }

        // Does the user want to search again?
        System.out.print("Do you want to search again? (Y or N): ");
        input = keyboard.readLine();
      } while (input.charAt(0) == 'y' || input.charAt(0) == 'Y');
   }
}



/**
   The StringBinarySearcher class provides a public static
   method for performing a binary search on an String array.
*/



public class ObjectBinarySearcher{

/**
      The search method performs a binary search on an String
      array. The array is searched for the number passed to
      value. If the number is found, its array subscript is
      returned. Otherwise, -1 is returned indicating the
      value was not found in the array.
      @param numbers The array to search.
      @param value The value to search for.
   */



   public static int search(String[] numbers, String value)
   {
      int first;       // First array element
      int last;        // Last array element
      int middle;      // Mid point of search
      int position;    // Position of search value
      boolean found;   // Flag     

      // Set the initial values.
      first = 0;
      last = numbers.length - 1;
      position = -1;
      found = false;


      // Search for the value.
      while (!found && first <= last)
      {
         // Calculate mid point
         middle = (first + last) / 2;


         // If value is found at midpoint...
         if (numbers[middle].equals(value))
         {
            found = true;
            position = middle;
         }

         // else if value is in lower half...
         // need tell is value is less then the integer?, with out using equality regulators
         else if (value.compareTo(numbers[middle]) < 0)
            {

            last = middle - 1;
            }
         // else if value is in upper half....
         else
            first = middle + 1;
      }

      // Return the position of the item, or -1
      // if it was not found.

      return position;
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:13:21+00:00Added an answer on May 20, 2026 at 5:13 pm

    Try this:

    String[] numbers = {"Jerry"};
    numbers[0] = numbers[0].toUpperCase();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this problem: I have a program which should fetch (let's say) 100 records
I have this problem I'm hoping someone knows the answer to. I have an
everybody; I have this problem in asp.net, I have a page where I insert
I have seen this problem arise in many different circumstances and would like to
I have faced this problem quite often during the last couple of months, during
I enjoy developing algorithms using the STL, however, I have this recurring problem where
I have hit upon this problem about whether to use bignums in my language
I have an idea for how to solve this problem, but I wanted to
I have been trying to tackle this problem , but I am having difficulty
I have spent too much time on this problem and am beginning to think

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.