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
DIA [1.3K]
3 years ago
7

(1) prompt the user for a string that contains two strings separated by a comma. (1 pt) examples of strings that can be accepted

: jill, allen jill , allen jill,allen ex: enter input string: jill, allen
Computers and Technology
1 answer:
GalinKa [24]3 years ago
5 0

package parsestrings;

import java.util.Scanner;

public class ParseStrings {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in); // Input stream for standard input

Scanner inSS = null; // Input string stream

String lineString = ""; // Holds line of text

String firstWord = ""; // First name

String secondWord = ""; // Last name

boolean inputDone = false; // Flag to indicate next iteration

// Prompt user for input

System.out.println("Enter input string: ");

// Grab data as long as "Exit" is not entered

while (!inputDone) {

// Entire line into lineString

lineString = scnr.nextLine()

// Create new input string stream

inSS = new Scanner(lineString);

// Now process the line

firstWord = inSS.next();

// Output parsed values

if (firstWord.equals("q")) {

System.out.println("Exiting.");

inputDone = true;

if (firstWord.matches("[a-zA-Z]+,[a-zA-Z]+")) {

System.out.print("Input not two comma separated words");

}

} else {

secondWord = inSS.next();

System.out.println("First word: " + firstWord);

System.out.println("Second word: " + secondWord);

System.out.println();

}

}

return;

}

}

You might be interested in
How many pounds must a sand bag weigh to test if a safety net can absorb the proper amount of force? A. 150 lbs. B. 200 lbs. C.
d1i1m1o1n [39]
The answer is 400 pounds.
6 0
3 years ago
Given two int variables , firstplacewinner and secondplacewinner, write some code that swaps their values . declare any addition
Mekhanik [1.2K]
Int tmp;
tmp = firstplacewinner;
firstplacewinner = secondplacewinner;
secondplacewinner = tmp;
5 0
3 years ago
What is the alogarithm for solving the perimeter of a triangle
Lapatulllka [165]

Answer:

 P = a + b +c

Explanation:

jkaksbajksnsn

3 0
3 years ago
What are some examples of productions categorized as non-broadcast productions?
leonid [27]

Answer:

Non-broadcast media incorporates

  • Recorded television
  • Radio
  • Podcasts
  • Internet
  • Streaming services.

Explanation:

Non-broadcast media is a phrase used to represent audio and visual communications that can be obtained at any moment. Non-broadcast media is the knowledge that can be switched on and off, suspended, rewound, and fast-forwarded at certain times.

Examples of non-broadcast productions

Non-broadcast media incorporates

  • Recorded television
  • Radio
  • Podcasts
  • Internet
  • Streaming services.

To learn more about broadcast productions refer:

  • https://brainly.in/question/17335292
  • https://brainly.in/question/44811105

4 0
3 years ago
When a typist changes from a conventional typewriter to a word processor, his typing schema will have to _____ to incorporate th
Elis [28]
<span>The schema will have to accommodate to make the person more easily able to perform the new task. Accommodation allows the new information to be made a part of a schema without changing the overall concepts in the schema. The schema itself stays unchanged for the most part, but the new information is more of a "tweak" to the schema than a full-on update.</span>
8 0
3 years ago
Other questions:
  • Which topology enables only one person, at one time, to send data to others on the network?
    6·1 answer
  • What will happen if Sam goes to the View menu, clicks Toolbars, and then clicks Picture?
    12·2 answers
  • Which key is used in word processors to create indentations?
    13·2 answers
  • . Does Zuckerberg believe in the thought that “the endpoint is when you sell the
    15·1 answer
  • Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,
    7·1 answer
  • Please help it would mean to world to me❤️ (WORD)
    13·1 answer
  • Which of the following are disadvantages of networks? Check all of the boxes that apply.
    14·1 answer
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • Which option should you choose to change the background of your current slide?
    10·2 answers
  • Computers that are joined together are called networks true or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!