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

  Questions on ferris wheel

Prepare a Flexible Budget Gator Divers is a company that provides diving services such as underwater ship repairs to clients in the Tampa Bay area.

  Logistic map

This assignment has two question related to maths. Questions are related to bifurcation cascade and logistic map.

  Finding the probability of cards

This assignment has questions related to probabiltiy.

  Systems of ode

Find all the xed points, and study their stability and Draw the phase portrait of the system, as well as the graphs of the solutions in all relevant cases.

  Derive the boolean expression

Derive the Boolean Expression and construct the switching circuit for the truth table stated

  System of equations

Evaluate which equations are under-identified, just-identified, and over-identified.

  Linear programming problem

Linear programming problem consisting of only two constraints with one objective function.

  Find the natural domain

Find the natural domain of the given functions.

  Introduction to numerical methods

Compute the coecients of the polynomials using the term recurrence relation.

  Chart of the topological manifold

De?nition of smoothness of functions on a smooth manifold is chart independent and hence geometric.

  Mathematics in computing

Questions related on mathematics in computing.

  Complex problems

Complex problems

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