Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

A passage of text is rated for difficulty by the length of the words it contains. You are to complete the class WordLengthFinder to group words by their length.

You are given a string. Create a Scanner to process the String. You are to print the words with the shortest words first. Within words of the same length, you are to print the words alphabetically.

You can use a Map where the keys are the Integer length and the values are the Set of the words of that length. This is similar to hw 17.

You can print the Set mySet like this: System.out.println(mySet);

For the string "Mary had a little lamb", the output would look like this

[a] [had] [Mary, lamb] [little]

In order to get words without following punctuation, create a scanner for the String and set the delimiter to use: scan.useDelimiter("[^A-Za-z0-9]+");

Code check will run your program more than once. Note that the second string is fairly long and you will have to scroll right to see expected and actual output.

----------------------------------------------------

Complete the following file:

WordLengthFinder.java

import java.util.TreeSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
public class WordLengthFinder
{
public static void main(String[] args)
{
String passage = "mary had a little lamb";
}

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93079048

Have any Question?


Related Questions in Computer Engineering

Qnbspvirtualbox aside what steps do you think are required

Q) VirtualBox aside, what steps do you think are required if we bought a brand new drive and plugged it into our system internally? a. Internally / externally, does it matter? b. If we plug it into the system, will it ju ...

Xl cos dividends are expected to grow at a 20 rate for the

XL Co.'s dividends are expected to grow at a 20% rate for the next 3 years, with the growth rate falling off to a constant 6% thereafter. If the required return is 14% and the company just paid a $3.10 dividend, what is ...

Question suppose that you receive an email from someone

Question : Suppose that you receive an email from someone claiming to be Alice, and the email included a digital certificate that contains M = ("Alice", Alice's public key) and [h(M)]_CA, where CA is a certificate author ...

What is the role of arp and how does it cause a security

What is the role of ARP and how does it cause a security concern? What is the different between global and private IP addresses? How does using NAT change a private IP address into a global IP address, and why is this so ...

Question suppose you have to design a mobile application to

Question : Suppose you have to design a mobile application to control your microwave over internet. Define the objective, assumptions and Interface Metaphors of this application.

Question in a sliding window protocol assume that the

Question : In a Sliding Window Protocol, assume that the senders and receivers window sizes are 3 packets each and a total of 6 packets are sent numbered 1-6. Draw time line diagrams corresponding to each of the followin ...

Calculate the standard gibbs free energy change and the

Calculate the standard Gibbs free energy change and the equilibrium constant for the oxidation of a formate ion to carbon dioxide at pH=7 and room temperature.

Suppose we have a collection of n different subsets of the

Suppose we have a collection of n different subsets of the set { 1, 2, ..., n } and they are in some arbitrary order, that is, we have subsets S1, S2, ..., Sn, but how many and which elements are in each of these subsets ...

The following few machines are given informal

The following few machines are given informal descriptions. Decide whether they are of CISC or of RISC design, and provide a short description of why. a) Machine A has over 300 instructions, many of which are executed at ...

According to the alzheimers association alzheimers disease

According to the Alzheimer's Association, Alzheimer's disease affects 1 in 10 people over the age of 65. What would be the shape, mean, and standard error of the sampling distribution of the proportion who suffer from Al ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As