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
Write the UPDATE command to increase the commission (column name :COMM) by 500 of all the salesman who have achieved sales (Colu
lara31 [8.8K]

Answer:

UPDATE COMPANY

SET COMM=COMM + 500

WHERE SALES> 20000;

Explanation:

The update command is used for alter the record in the database management system in the table .The update command command modify the record on the some condition in the table in the database management system.

Following are syntax for using the update command .

UPDATE table-name

SET column name 1,column name 2 .........

Where condition

  • In the given question table -name is "COMPANY" the condition is on the sales column and it update the table only when sales is more than 20000 and set the column COMM by 500.
4 0
3 years ago
From your fist impression, write down what first comes to mind as to what is good and bad about the way the device works.
nalin [4]

Answer:

xczczxczx

Explanation:

6 0
3 years ago
Designations at the end of file names such as .docx and .html are called
Amanda [17]

Answer:

Designations at the end of file names such as .docx and .html are called. File extensions.

Explanation:

7 0
3 years ago
Which of the following best describes the protocols used on the Internet?
max2010maxim [7]

Answer:

D: The protocols of the Internet are open and used by all devices connected to the network

Explanation:

There are billions of devices connected to the Internet, and hundreds of different kinds of devices: laptops, tablets, phones, refrigerators, handheld credit card readers, and so on. Protocols (standards) ensure that the variety of devices interact with each other smoothly.  There are a lot of protocols! The Internet was designed with several layers of abstraction that sort the protocols according to what part of the process they support.

5 0
3 years ago
Given the declarations struct BrandInfo { string company; string model; }; struct DiskType { BrandInfo brand; float capacity; };
Nonamiya [84]

Answer:

Type of myDisk.brand is BrandInfo.

Explanation:

4 0
3 years ago
Other questions:
  • c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m
    14·1 answer
  • The part of the poppet valve that contacts the valve seat is called the A. face. B. margin. C. head. D. stem.
    6·2 answers
  • Template files can contain the following items: text, tables, images and lists.
    10·1 answer
  • There are no breakpoints in the "Access Customer Account" subpage however there is an error. What will happen if you choose to s
    11·1 answer
  • Each entry in a linked list is called a_______
    11·1 answer
  • Managers looking for advice on properly dealing with obsolete technology hardware can: a) consult the e-Stewards program b) seek
    9·1 answer
  • Which statement describes what this command accomplishes when inside and outside interfaces are correctly identified for NAT? ip
    13·1 answer
  • A row in a table _____? for computer class and i’m in the middle of a test!
    14·1 answer
  • Select the correct answer from each drop-down menu.
    7·1 answer
  • Write a for loop that uses the loop control variable to take on the values 0 through 10.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!