Prompt the user for a string that contains two strings

Assignment Help Computer Engineering
Reference no: EM132217603

Warm up: Parsing strings (Java)

(1) Prompt the user for a string that contains two strings separated by a comma.

Examples of strings that can be accepted:

Jill, Allen

Jill , Allen

Jill,Allen

Ex:

Enter input string: Jill, Allen

(2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings.

Ex:

Enter input string: Jill Allen Error: No comma in string. Enter input string: Jill, Allen

(3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings.

Ex:

Enter input string: Jill, Allen First word: Jill Second word: Allen

(4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit.

Ex:

Enter input string: Jill, Allen First word: Jill Second word: Allen Enter input string: Golden , Monkey First word: Golden Second word: Monkey

Enter input string: Washington,DC First word: Washington Second word: DC Enter input string: q

Reference no: EM132217603

Questions Cloud

Write the definition of a class player containing : A constructor that takes two int arguments and assigns the first one to counter and the second one to limit.
Calculate the average of the values contained in the integer : Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double.
Write a program that prints the 128-character ascii table : Write a program that prints the 128-character ASCII table. It should print the table in eight tab-separated columns.
Write a statement that increments the value of the int : Write a statement that increments the value of the int variable total by the value of the int variable amount.
Prompt the user for a string that contains two strings : Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered.
How many users are on the local system : Which character is used to separate fields in /etc/passwd? How many fields are used to describe each user? How many users are on the local system?
Write a loop that subtracts 1 from each element in lower : Write a loop that subtracts 1 from each element in lowerScores. If the element was already 0 or negative, assign 0 to the element.
Implement a recursive descent parser for a logic calculator : The program should not exit when it encounters an error in the expression. Rather, it should output error information and then accept the next expression.
Explain what needs to be done to defend accounts : Eplain What You Have to do to Defend Accounts. Explain what needs to be done to defend accounts .

Reviews

Write a Review

Computer Engineering Questions & Answers

  Describe some of the emerging trends in information

discuss some of the emerging trends in information technology e.g. computer hardware software data analysis. what

  Define it priorities and governance for it without

using a company of your choice determine the strategic business goals. develop an it strategy that aligns to the

  Create a more secure environment for company data

You have been hired as a security specialist by a company to provide methods and recommendations to create a more secure environment for company data.

  What are the sampling rates for iPods and CD players

What are the sampling rates and number of quantization levels for iPods, CD players, DVD-video players, DVD-audio players, and Blu-ray players?

  Describe a nonrecursive algorithm for enumerating

Describe a nonrecursive algorithm for enumerating all permutations of the numbers {1,2,...,n}.

  What is an important port near you what comes into this

the paper is to be at leastnbsp4 pages excluding the title page and bibliography. apa is to be used in citations.

  Identify two reported court cases that have impacted the

identify two reported court cases that have impacted the evidentiary process or analysis in digital forensic cases

  Provide vhdl code for ram design of hack computer project

I need the VHDL code for the RAM Design of the Hack Computer Project. I am on in my Product Development class. I need this asap please.

  Creating program that accepts infix expression as input

The left and right sub trees of an operator explain a sub expression that is evaluated and utilized as one of the operands for operator. Write down a program that inputs an infix expression and generates an expression tree. Output prefix expressi..

  What are preconditions and postconditions of a subprogram

What are preconditions and postconditions of a subprogram? When should allocation of tasks among functions be made?

  Write all of the declarations needed to declare

Write all of the declarations needed to declare the following array variables. A table with five rows and six columns that contains Boolean values.

  Distributed scheduling algorithms

The receiver initiated the distributed scheduling algorithms assumed task pre-emption at sender site. Devise an approach, that is receiver-initiated however non pre-emptive.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd