1 write a program that allows a user to enter a line of

Assignment Help Mathematics
Reference no: EM13375967

1, Write a program that allows a user to enter a line of text, counts number of words and number of vowels in the sentence, and gives the average number of vowels per word in the message (vowels are letters a, e, i, o, u or A, E, I, O , U). Your program should contain a class SentenceCounter and a graphical user interface called SentenceCounterGUI.

The class SentenceCounter can be used to count words, vowels and the average number of vowels per word in the sentence. It has the following methods: 

  • a constructor accepts a sentence as a parameter, and calls relevant methods to evaluate instance variables;
  • a method countWords counts number of words in the sentence;
  • a method countVowels  calculates a number of vowels in the sentence;
  • a method averageVowels calculates the average number of vowels per word in the sentence;
  • accessor (get) methods return a number of words, vowels and average number of vowels;
  • the method toString returns a full information about an object of the SentenceCounter class.

The following UML diagram might be of assistance:

     SentenceCounter

-          sentence: String

-          numberOfWords: int

-          numberOfVowels: int

-          average: double

      +   SentenceCounter(sentence : String)

      +   countWords ( ) : void

      +   countVowels ( ) :  void

      +   averageVowels ( ) : void

      +   getNumberOfWords( ) : int

      +   getNumberOfVowels( ) : int

      +   getAverage( ) : double

      +   toString( ) : String

2. Write a graphical user interface class called SentenceCounterGUI. It should be able to manipulate the sentence of words and have the following behaviour:

  • label "Enter a sentence";
  • text field to enter a sentence and create a SentenceCounter object;
  • button "Count words" and the label to display it;
  • button "Count vowels" and the label to display it;
  • button "Average vowels" and the label to display it;

The class should include a main method that prepares a frame in which the panel is displayed.

Reference no: EM13375967

Questions Cloud

Suppose the demand for toothpaste is qd 11- 2p while the : suppose the demand for toothpaste is qd 11- 2p while the supply of toothpaste is qs 6.5 p where quantity is measured
Although new york state is second only to washington state : although new york state is second only to washington state in production of apples its production has been declining
What happens to the indifference curves when a households : what happens to the indifference curves when a households income is reduced?questionwhat is a budget constraint? how
What happens to the indifference curves when a households : what happens to the indifference curves when a households income is reduced?questionwhat is a budget constraint? how
1 write a program that allows a user to enter a line of : 1 write a program that allows a user to enter a line of text counts number of words and number of vowels in the
Use the case study on pages 408-424 of your textbook : use the case study on pages 408-424 of your textbook oakland j. s. 2003 tqm text with cases. 3rd ed. oxford
A medical infusion pump operates in the following mannerthe : a medical infusion pump operates in the following mannerthe user selects the infusion rate between 00.0 and 99.9 ml per
Prepare a three-page paper in apa style that describes : prepare a three-page paper in apa style that describes explains addresses and answers the following. the united states
Question 1 bending about two axesthe load p 2 kn is : question 1 bending about two axesthe load p 2 kn is applied to the end of rectangular section cantilever beam shown

Reviews

Write a Review

Mathematics Questions & Answers

  What is the probability

what is the probability that all will make a purchase and evaluate the probability that a light bulb will burn out in less than 1000 hours.

  System of linear equations-stamps

A stamp collection consists of 3, 8, and 15 cent stamps. The number of 8 cent stamps is one less than triple the number of 3 cent stamps. The number of 15 cent stamps is six less than the number of 8 cent stamps.

  Find a function that models the length l

A boy who is 4 feet 2 inches tall stands near a street light that is 23 feet tall. Find a function that models the length L (in feet) of his shadow in terms of his distance d feet from the base of the street light.

  What is the average rise in temperature per hour

the temperture is 33 degrees at 10am and 60 degrees at 4pm. what is the average rise in temperature per hour?

  Numerical analysis-simpson rule

Explain how we arrive at the formula for Simpson's rule (standard formula) using the Lagrange Interpolating Polynomial of degree 2. Ignore the error term, and do not compute any integral.

  Constructing two equal angles

Construction- To construct two angles the same measurement Please construct the following. Please make it large enough. Draw an acute angle. Label the vertex P.

  Find exact coordinates of the centroid of the region

Find exact coordinates of the centroid of the region in the first quadrant bounded by the given curves.

  Determine the margin of error if 99% confidence is desired

Explain what assumption the researcher should be willing to make if a margin of error is desired.

  Probability counting principle

Probability : Counting Principle, A social security number has 9 digits. How many different S.S numbers are possible if:

  Algorithm to detect single bad coin

Describe an algorithm that identifies the bad coin in at most three weighings and also determines whether it is heavier or lighter than the others, using only a pan balance.

  Compute the amount of money

The cost of one lunch ticket is $2.25. What is the equation the student could use to calculate the amount of money, m, left after d days, assuming the student uses one lunch ticket each day?

  Test the instructor claim at a 5% level of significance

Test the instructor claim at a 5% level of significance

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