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]
2 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]2 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
• What is the difference between primary storage, secondary storage, and off-line storage
sergiy2304 [10]


Primary storage refers to your RAM it is internal storage.

Secondary storage is any storage that is not the primary storage that permanently stores data. Examples are hard drive, tape disk drive, floppy disk drive  and compact disk drive. 

Off-line storage refers to any device that stores data that is not permanently attached to the computer. Example flash drives, The data remains on the storage device and can be connected to a different computer. 

3 0
3 years ago
Yuri, a medical assistant, has been asked to send an account of a patient's last office visit to another doctor's office. The te
g100num [7]
The internet,,

To let the other doctor know about specific details on the patient, and other excessive information.

Hope this helps!! :)
6 0
3 years ago
Read 2 more answers
A Game Object must have a Transform<br><br> True<br><br> False
vovikov84 [41]

Answer:

Yes

Explanation:because,have to update there apps or games and change there characters

3 0
3 years ago
Often duties and taxes are imposed on cars that are imported fron other countries. What type of incentives are these duties and
Kipish [7]

These duties and taxes are charged on imported cars in order to incentivize the people to purchase vehicles built in the home county instead.

6 0
3 years ago
To save a new copy of an existing database, a user can open the original database and select ________ from the file tab.
Yuri [45]
And select copy from the file tab.
6 0
3 years ago
Other questions:
  • Which network could NOT carry commercial traffic?
    5·1 answer
  • which student organization helps students with career development by having them become interms to sponsor conferences?
    9·1 answer
  • Which of the following is an encryption tool that allows users to encrypt files and folders by simply right-clicking a given obj
    10·2 answers
  • A url consists of a ____, a domain name, sometimes the path to a specific web page or location in a web page, and the web page n
    11·1 answer
  • Fullsoft, Inc. is a software development company based in New York City. Fullsoft’s software product development code is kept co
    10·1 answer
  • Although highly accurate navigational information from the GPS constellation is exploitable by adversary forces, it is unlikely
    5·1 answer
  • :If a process terminates, will its threads also terminate or will they continue to run? Explain your answer.
    14·1 answer
  • A technician is configuring a new SOHO multifunction wireless router at a customer’s location to provide network access to sever
    12·1 answer
  • As part of the systems engineering development team, use IDEF0 to develop a functional architecture. The functional architecture
    13·1 answer
  • The ______ Works on a single variable or constant. *​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!