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
gregori [183]
3 years ago
12

This exercise asks you to write a program that tests some of the built-in subroutines for working with Strings. The program shou

ld ask the user to enter their first name and their last name, separated by a space. Read the user's response using TextIO.getln(). Break the input string up into two strings, one containing the first name and one containing the last name. You can do that by using the indexOf() subroutine to find the position of the space, and then using substring() to extract each of the two names. Also output the number of characters in each name, and output the user's initials. (The initials are the first letter of the first name together with the first letter of the last name.) A sample run of the program should look something like this:
Please enter your first name and last name, separated by a space.
? Mary Smith
Your first name is Mary, which has 4 characters
Your last name is Smith, which has 5 characters
Your initials are MS
Computers and Technology
1 answer:
klasskru [66]3 years ago
5 0

Answer:

Java.

Explanation:

// Get user input

System.out.print("Please enter your first name and last name separated by a space: ");

userInput = TextIO.getln();

// Find index of space character

int spaceIndex = userInput.indexOf(' ');

// Extract first and last name using space character index

// I have used length() method to get length of string userInput.

String firstName = userInput.substring(0, spaceIndex-1);

String lastName = userInput.substring(spaceIndex+1, userInput.length()-1);

// Print the required statements

System.out.print("Your first Name is %s, which has %d characters%n", firstName, firstName.length());

System.out.print("Your last Name is %s, which has %d characters%n", lastName, lastName.length());

// I have used space character Index to get the Initial of last name

System.out.print("Your initials are %s%s", firstName.substring(0,0), lastName.substring(spaceIndex+1, spaceIndex+1));

You might be interested in
How to bypas power switch on pc and make it switch on
Andreas93 [3]
If your powersupply has the standard 24 pin connector, you can make it switch on by connecting a green and a black (find a good picture to see the pin numbers). Google for the "paperclip test" for details.
6 0
3 years ago
One of the First-Generation Computer built in 1942 during the Second World War and fully utilized to compute Military Artillery
Temka [501]
ENIAC, in full Electronic Numerical Integrator and Computer, the first programmable general-purpose electronic digital computer, built during World War II by the United States. American physicist John Mauchly, American engineer J. Presper Eckert, Jr., and their colleagues at the Moore School of Electrical Engineering at the University of Pennsylvania led a government-funded project to build an all-electronic computer.

From Brittanica.com
7 0
3 years ago
Which one of these is least like the others javascript ruby python mysql.
Cerrena [4.2K]

MySQL is a relational database management system based on the structured query language, JavaScript, Ruby and Python are programming languages ​​used largely in web development.

<h3>What is MySQL?</h3>

It is a system that allows database management, that is, it is a database query language that is used to define relational database structures.

<h3>Characteristics of MySQL</h3>

  • The system works on the client-server principle, where the server represents the actual database management system and is responsible for storing and distributing the data.

  • It can be used on Windows, Linux, Unix and some other operating systems.

Therefore, we can conclude that MySQL is a relational database management system based on the structured query language, JavaScript, Ruby and Python are programming languages ​​used largely in web development.

Learn more about MySQL here: brainly.com/question/4964005

6 0
2 years ago
What is stored in studentScores after running the program code?
mixer [17]

Answer:C

Explanation:

6 0
2 years ago
What does SEO stand for?
soldier1979 [14.2K]
Search Engine Optimization
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is not a safety practice for working near power lines?
    5·1 answer
  • I don’t know technically
    9·2 answers
  • How to adjust screen from 1024x728 to 800x600
    6·1 answer
  • The amount of data produced worldwide is increasing by ___% each year.
    5·1 answer
  • A wireless engineere has an access point using 5.725-ghz channel in the united states. In which band is the AP operating?
    9·1 answer
  • How many positions there are in the media and design department?
    14·2 answers
  • Disadvantages of Batch<br>operation system​
    5·1 answer
  • Define quality control​
    12·1 answer
  • Your program will be used by many departments at the university. Your comments will be important to their IT people. What would
    15·1 answer
  • Assume the name of your data frame is flavors_df. What code chunk lets you review the structure of the data frame?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!