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]
2 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]2 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
Angela recently purchased a new Android smartphone. While purchasing the phone, Angela was told that she would need to set up a
vagabundo [1.1K]

Answer:

G m a i l

Explanation:

G m a i l by Google is the main commercial email provider to Android Phones. This is because it offers so many features that other email provider do not. One of this is the ability to backup your data, including contacts, messages, and others. This features along with other features makes Google g m a i l account the best option for Android users.

8 0
3 years ago
Stamps offers at-home postage and mailing for a monthly fee. Customers are able to carry a balance on their accounts that allows
alexdok [17]

Answer:

The pop-up button is necessary to show acceptance of the terms

Explanation:

5 0
2 years ago
3. By default, Blender® remembers your last 32 actions and allows you to undo them one at a time by pressing CTRL+Z. (1 point)
Setler [38]
Answers:

(3) True
(4) Num Lock

Explanations:
(3) To undo any task in most of the softwares including Blender, CTRL + Z is used. If you want to double check, go to preference ->  Input -> Search for undo. You would see CTRL + Z shortcut there for one time undo (as shown in the picture 1 attached.) Hence (TRUE).

(4) As in blender, during the scene creation, the designers usually use top, left, right or bottom view. Blender has the built-in keys set for those views. As you can see in the second image that the Top view is set to NumPad 7 (likewise others set to other numbers). In order to use the those numpad numbers, you must turn on the NumLock! Hence NumLock is the answer.

3 0
3 years ago
Which of these is a benefit of using the Sort option?​
Reika [66]

There are many benefits of using the shot options in Excel. Some benefits are allowing you to short by number,date,color, letter, columns,or text. This benefits the user because it allows the user to bring data up more easily.

I hope this answers is helpful

3 0
3 years ago
Which software is used to play, create, and modify audio and video files?
Alenkasestr [34]
Windows Movie Maker, iMovie, Final Cut Pro (x), QuickTime?
8 0
3 years ago
Read 2 more answers
Other questions:
  • What Software is used to play,create, and modify audio and video files
    7·2 answers
  • What important information is needed if you are installing an oem version of windows 7?
    6·1 answer
  • Nested if-else structures can contain many blocks of code. How many of those blocks of code might be executed?
    14·1 answer
  • How many hosts are in each subnet?
    15·1 answer
  • A mobile device user has tried to install a new app numerous times without success. She hasclosed all unused apps, disabled live
    12·1 answer
  • Why is there no I do you time of day when all students should study
    10·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MY QUESTION WHICH IS DUE TODAY PLZ ANSWER ALL OFIT!!!!
    10·1 answer
  • I need the answers. i don’t get this
    11·1 answer
  • Firestick optimizing system storage and applications loop
    12·1 answer
  • You are the Emergency Management Director of a small island nation. Your nation has come under Cyber-attack and the attackers ha
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!