(Random Sentences) Write a
After the preceding program is written and working, modify it to produce a short story consisting of several of these sentences. (How about the possibility of a random term-paper writer?)
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
C How to Program (8th Edition)
Additional Engineering Textbook Solutions
Artificial Intelligence: A Modern Approach
Starting Out with Java: From Control Structures through Objects (6th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Starting out with Visual C# (4th Edition)
Starting Out with Python (4th Edition)
- Reverse ArrayWrite a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversedin the copy. The function should return a pointer to the new array. Demonstrate thefunction in a complete program.arrow_forwardCreate a program and flowchart for the following: Write a program that uses random-number generation to create sentences. The program should use four arrays of pointers to char called article, noun, verb and preposition. The program should create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, it should be concatenated to the previous words in an array large enough to hold the entire sentence. The words should be separated by spaces. When the final sentence is output, it should start with a capital letter and end with a period. The program should generate 20 such sentences. The arrays should be filled as follows: The article array should contain the articles "the", "a", "one", "some" and "any"; the noun array should contain the nouns "boy", "girl", "dog", "town" and "car"; the verb array should contain the verbs "drove", "jumped", "ran", "walked" and "skipped"; the preposition…arrow_forwardC++ Lexicographical Sorting Given a file of unsorted words with mixed case: read the entries in the file and sort those words lexicographically. The program should then prompt the user for an index, and display the word at that index. Since you must store the entire list in an array, you will need to know the length. The "List of 1000 Mixed Case Words" contains 1000 words. You are guaranteed that the words in the array are unique, so you don't have to worry about the order of, say, "bat" and "Bat." For example, if the array contains ten words and the contents are cat Rat bat Mat SAT Vat Hat pat TAT eat after sorting, the word at index 6 is Rat You are encouraged to use this data to test your program.arrow_forward
- 1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.arrow_forwardPROGRAMMING LANGUAGE: C++ Write a program that accepts up to 20 test-match scores of a batsman in the range of 0 to 100 from the user and stores them in an array. Then main should report how many perfect scores (i.e., scores of 100) and ducks (i.e., scores of 0) were enteredarrow_forward4. Declare a two-dimensional array that has 3 columns and 4 rows. 5. Write a for loop that will printout each value in the array from problem 4.arrow_forward
- Simple try-catch-finally Program This lab is a simple program that demonstrates how try-catch-finally works. You will notice the output when you enter incorrect input (for example, enter an incorrect index or an alpha character instead of an integer). Type up the code, execute and submit the results ONLY. 1. Enter a valid array index 2. Enter an invalid array index 3. Enter a letter instead of an integer - NOTE: Using the general error will show you the type of exception was caught, and you can then update your code to catch that type of error. 4. Try putting the "Exception e" before the IndexOutOfBounds Exception eob what happens and are you able to run the code - what happens? CODE: import java.util.Scanner; public class TryCatchFinally { public static void main(String[] args) { // Instantiate a scanner Scanner input = new Scanner(System.in); } } // Create an array with 4 values int an IntArr[] = {10, 15, 26, 99); try { System.out.println("Enter the index to see the number: "); int…arrow_forwardAnswer in C++ Programming Language. C++, Array Write a program that will ask the user to enter a set of numbers and outputs all the subsets of that set. The size of the array is 5. Ask the user if he wants to repeat the program by pressing y/Y.arrow_forwardQ3: Write a complete C++ code for creating an array accepts any 10-integer numbers from the user and then apply the following tasks: 1. Print the smallest index of the smallest element. 2. Print the multiplication of all elements in the array. 3. Put the even & the odd elements of the array in two separate arrays, and then print them.arrow_forward
- Totaled columns. (Ending of sentence on attachment) please assist with Java code. Please attachment screenshot of successful output.arrow_forwardPart 4: Arrays Program c++ Write a program which takes 2 arrays of 10 integers each, a and b. c is another array with 20 integers. The program should put into e the appending of b to a, the first 10 integers of e from árray a, the latter 10 from b. Then the program should display the array c, then find and display the Minimum value of the array c. ANSWERarrow_forwardTRUE or FALSE - A pointer can be used to access elements of an array. Select one: a.TRUE b.FALSEarrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning