Placeholder

CSIS 312 Assignment 4 Random Sentences

$9.99

Description

We now discuss the features of class StringBuilder for creating and manipulating dynamic string information—that is, modifiable strings. Every StringBuilder is capable of storing a number of characters specified by its capacity. If a StringBuilder’s capacity is exceeded, the capacity expands to accommodate the additional characters.
In programs that frequently perform string concatenation, or other string modifications, it’s often more efficient to implement the modifications with class StringBuilder rather than String.
Instructions
Write an application that uses random-number generation to create sentences. Create four String arrays called article, noun, verb, and preposition containing the following words:
The article array must contain the articles “the,” “a,” “one,” “some,” and “any.”
The noun array must contain the nouns “boy,” “girl,” “dog,” “town,” and “car.”
The verb array must contain the verbs “drove,” “jumped,” “ran,” “walked,” and “skipped.”
The preposition array must contain the prepositions “to,” “from,” “over,” “under” and “on.”
Create a sentence (using the StringBuilder type) by selecting a word at random from each array in the following order:
Article,
noun,
verb,
preposition,
article, and
As each word is picked, concatenate it to the previous words in the sentence using the StringBuilder append() method. The words must be separated by spaces. When each sentence is output, the first letter of the first word should start with a capital letter and the sentence should end with a period (see sample output below). The application must generate and display 20 sentences.
SCREENSHOTS
SOLUTION
PAYMENT
The solution consists of:
A report word document for this assignment
All Java programs and classes
A Netbeans project in case you want to run the project on your computer.
Screenshots showing program running
Attachments [Move over files to preview content of those files]
CSIS_312_Assignment_4.zip (226.11 KB)
classes
Sentence.class
SentenceTest.class
CSIS312 Assignment 4 Report.docx
Netbeans project
CSIS312Assignment4
pom.xml
src
main
java
Sentence.java
SentenceTest.java
target
classes
.netbeans_automatic_build
Sentence.class
SentenceTest.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
.netbeans_automatic_build
screenshots
CSIS 312 Assignment 4 Screenshot 1.jpg
CSIS 312 Assignment 4 Screenshot 2.jpg
source code
Sentence.java
SentenceTest.java
Preview Sentence.java
xxxxxx xxxxxx xxxxxx[] xxxxxxxxxxx = {“xx”, “xxxx”, “xxxx”, “xxxxx”, “xx”};
xxxxxx xxxxxx xxxxxx xxxxxx = xxx xxxxxx(xxxxxx.xxxxxxxxxxxxxxxxx());
xxxxxx xxxxxx xxxxxx xxxxxxxxxx() {
xxxxxx xxxxxxx[xxxxxx.xxxxxxx(xxxxxxx.xxxxxx)];
}

public static String getNoun() {
return noun[random.nextInt(noun.length)];
}

public static String getVerb() {
return verb[random.nextInt(verb.length)];
}

public static String getPreposition() {
return preposition[random.nextInt(preposition.length)];
}
}
xxxxxx xxxxxx xxxxxxxxxxx() {
xxxxxxxxxxxxx xxxxxxxx = xxx xxxxxxxxxxxxx();
Preview SentenceTest.java
xxxxxx xxxxx xxxxxxxxxxxx {
xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) {
xxxxxx.xxx.xxxxxxx(“xxxx xxxxxxx xxxx xxxxxxxx 20 xxxxxxxxx:”);
Sentence object = new Sentence();
for (int i = 0; i < 20; i++) { System.out.println(object.getSentence()); } } } } Preview Sentence.java xxxxxx xxxxxx xxxxxx[] xxxxxxxxxxx = {"xx", "xxxx", "xxxx", "xxxxx", "xx"}; xxxxxx xxxxxx xxxxxx xxxxxx = xxx xxxxxx(xxxxxx.xxxxxxxxxxxxxxxxx()); xxxxxx xxxxxx xxxxxx xxxxxxxxxx() { xxxxxx xxxxxxx[xxxxxx.xxxxxxx(xxxxxxx.xxxxxx)]; }public static String getNoun() { return noun[random.nextInt(noun.length)]; }public static String getVerb() { return verb[random.nextInt(verb.length)]; }public static String getPreposition() { return preposition[random.nextInt(preposition.length)]; } } xxxxxx xxxxxx xxxxxxxxxxx() { xxxxxxxxxxxxx xxxxxxxx = xxx xxxxxxxxxxxxx(); Preview SentenceTest.java xxxxxx xxxxx xxxxxxxxxxxx { xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) { xxxxxx.xxx.xxxxxxx("xxxx xxxxxxx xxxx xxxxxxxx 20 xxxxxxxxx:"); Sentence object = new Sentence(); for (int i = 0; i < 20; i++) { System.out.println(object.getSentence()); } } } } Price: $19 You May Also Like: CSIS 312 Assignment 1 Time2 Class CSIS 312 Entire Course CSIS 312 Assignment 2 Employee Class CSIS 312 Assignment 3 Payroll System CSIS 312 Assignment 5 LinkedList Object CSIS 312 Assignment 6 printArray and Factorial Calculator CSIS 312 Assignment 7 Pair Class CSIS 312 Assignment 8 Stack Data Structure CSIS 312 Assignment 6 Print Array CSIS 312 Assignment 8 SecureRandom

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.