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
Images that are made up of pixels and cannot be resized without losing quality?
Inessa05 [86]

Answer:

there are no known pictures that can be zoomed in and not lose quality. they will all be pixelized. mostly everything on a computer is made of pixels.

Explanation:

hope this helps!

~evita

8 0
3 years ago
. Alex discovered a bunch of SATA drives in a box at the office and needs to check the contents. What can he do so that Windows
ZanzabumX [31]

You have to make sure the BIOS boot is set to the normal hard drive first, then plug in the SATA cable and power properly

8 0
3 years ago
Real GDP is found by removing the effects of inflation. How is this done mathematically?
tia_tia [17]
<span>B. By dividing Real GDP by (100/100-inflation rate).</span>
3 0
3 years ago
Premiere Pro CS4 is the first version to be optimized for _______operating systems, although it is not natively 64-bit.
blondinia [14]
64-bit, according to the product description, and other sources.


7 0
3 years ago
which server edition doesn't support any server roles that you would typically use with standard version
ioda

On the standard version of Microsoft Windows, Dynamic Host Configuration Protocol Server and Hyper-V Remote Access are two roles that aren't supported on Azure Virtual Machines - a type of server.

<h3>What is a Server?</h3>

It is to be noted that this is a computer device (hardware) or virtual environment (software) that feeds another computer with special services.

<h3>Type of Server</h3>

The following are various types of servers:

  • Webserver
  • Proxy Server
  • Virtual Machine (VM)
  • Database Server
  • Mail Server

See the link below for more about Servers:

brainly.com/question/25435769

8 0
3 years ago
Other questions:
  • How can i appear offline without fb messenger saying "last active 1 minute ago"?
    5·1 answer
  • A user would like to format an arrow that has been inserted into a chart. What is the most efficient method for completing this
    9·1 answer
  • Activities that scan network locales for active systems and then identify the network services offered by the host systems is kn
    12·1 answer
  • True or False?
    8·1 answer
  • Who can pick up GPS signals
    14·1 answer
  • What are the importance of switches in our electron device
    15·1 answer
  • What kind of software program delivers advertising content in a manner that is unexpected and unwanted by the user, and is typic
    14·1 answer
  • A small network used for communication between personal computing devices is known as?
    8·1 answer
  • One subtask in the game is to ‘refuel a car’. Explain why ‘refuel a car’ is an abstraction.
    13·1 answer
  • Your development team is planning to host a development environment on the cloud. This consists of EC2 and RDS instances. This e
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!