1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Illusion [34]
3 years ago
11

Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o

f each sentence capitalized. The program should let the user enter a string and then pass it to the function, printing out the modified string.
Computers and Technology
1 answer:
soldi70 [24.7K]3 years ago
3 0

Answer:

import java.util.Scanner;

public class Main

{

public static void main(String[] args) {

 System.out.println("Enter String");

 Scanner sc1=new Scanner(System.in);

 String st1=sc1.nextLine();

 convertfirstchartoupper(st1);

 //System.out.println(st1);

 

}

private static void convertfirstchartoupper(String st1){

     

      char[] arr = st1.toCharArray();

      int k =0;

      arr[0]=Character.toUpperCase(arr[0]);

      while(k<arr.length)

      {

         

         if(Character.isWhitespace(arr[k]))

         {

             

             arr[k+1]=Character.toUpperCase(arr[k+1]);

             

         }

         

         

        k++;

      }

      k=0;

       while(k<arr.length)

      {

         

        System.out.print(arr[k]);

         

        k++;

      }

  }

}

Explanation:

In the above java program, we change a string into an array of characters and then check for whitespace. the letter next to while space is the first letter of the new word, and hence we capitalize that letter. And this is what is required. However, we can split the sentence into a string of words as well, and then capitalize the first letter of each word.

You might be interested in
Write a python program that will read a number (num) and display all the numbers divisible by 3 or 5
coldgirl [10]

DIVISIBLE BY 10

Explanation:

BECAUSE I DONT KNOW

6 0
3 years ago
When a file is transferred between two computers, two acknowledgment strategies are possible. In the first one, the file is chop
ExtremeBDS [4]

Answer:

Client server system, packets in the network and the discussion regarding two approaches have been done. See the attached pictures.

Explanation:

See attached pictures for explanation.

4 0
3 years ago
Which Computer career field enables you to create and design interactive multimedia products and service
Stells [14]
The answer is Web and Digital communications
4 0
3 years ago
Read 2 more answers
What does the word strained mean as it is used in paragraph 16 the story is from where the red fern grows but this are the answe
Luba_88 [7]

Answer:

i just  need points sryYY

Explanation

7 0
3 years ago
What type of activities are performed with the help of the software used in hospitals?
faust18 [17]

Answer:

Xrays, Ultrasounds, managing patient records, communicating with colleagues, etc.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following would be a tradeoff of a scientific advancement that enables us to catch fish from the ocean faster than
    5·1 answer
  • I only want someones opinion on this not anything you would find in a book.
    7·1 answer
  • 4. The same data source can be used multiple times in creating mail-merge documents.
    7·1 answer
  • What uses HTML hypertext links that users can click to access different locations or information?
    11·1 answer
  • What are factors that limit a technological design
    11·2 answers
  • Effective presentations vary the color scheme on each slide.
    7·2 answers
  • If you do not use the mini toolbar, it remains on the screen. _______________​ Group of answer choices True False
    8·1 answer
  • There are many modes of remote visual communication. which is the most common mode
    5·1 answer
  • Name TanushSAVAGE. As given in the picture, Subscribe!
    15·1 answer
  • A. Get a value for x from the user.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!