QUESTION ONE (40 MARKS)
1. Create a java program that will count all words in a sentence. The program should have a minimum of two classes.
1.1 The first class should be named class1, this class will have the following:
- The main method (starting point) (5)
- The object of class2 (5)
- Should also call the get method count_words(String str) (5)
1.2 The second class should be named class2, this class should have the following:
- A constructor (5)
- A get method named count_words(String str) (10)
1.3 Constract a flowchart for class1 and class2 both combined. (10)
QUESTION TWO (20 MARKS)
2.1 Create a Java program that will display the first 40 pentagonal numbers. Hint: A pentagonal number is a figurate number that extends the concept of triangular and square numbers to the pentagon, but, unlike the first two, the patterns involved in the construction of pentagonal numbers are not rotationally symmetrical. (20)
Do you need help with this assignment or any other? We got you! Place your order and leave the rest to our experts.